PHP 5 for Dummies Free Open Book

PHP 5 for Dummies

Previous PageNext Page
Chapter 7
Controlling the Flow of the Script
In This Chapter
Changing the order in which statements are executed
Setting up conditions
Joining simple conditions to make complex conditions
Using conditions in conditional statements and loops
Writing 
if
statements
Building and using loops for repeated statements
Breaking out of loops
P
HP scripts are a series of instructions in a file. PHP begins at the top 
of the file and executes each instruction, in order, as it comes to it.
However, some scripts need to be more complicated. You may want your
script to display one page to new customers and a different page to existing
customers. Or you may need to display a list of phone numbers by executing
a single 
echo
statement repeatedly, once for each phone number. This chap-
ter describes how to change the order in which simple statements are exe-
cuted by using complex statements such as conditional statements or loops.
Changing the Order of 
Statement Execution
Simple statements in PHP are executed one after another from the beginning
of the script to the end. For example, the following statements in a script are
executed in order:
$a = “Good Morning”;
echo $a;
$a = “Good Afternoon”;
echo $a;
To change the order of execution of these statements, you have to change the
order of the statements themselves, as follows:
Previous PageNext Page


     Main Menu
PHP 5 for Dummies
Table of Contents
Introduction
Part I: Say Hello to the PHP Scripting Language
Part II: Variables and Data
Part III: Basic PHP Programming
Using Array and 0 - Page 145
Chapter 7: Controlling the Flow of the Script
Changing the Order of Statement Execution
Setting Up Conditions
Using Conditional Statements
Repeating Actions by Using Loops
Chapter 8: Reusing PHP Code
Chapter 9: Object-Oriented Programming Meets PHP
Part IV: Common PHP Applications
Part V: The Part of Tens
Part VI: Appendixes
Index
Team DDU


More Books
PHP Hacks
Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
The Koran (Holy Qur'an)
Macromedia Flash 8 Bible
Search Engine Optimization for Dummies
YouTube Traffic
PHP 5 for Dummies
Harry Potter and The Chamber of Secrets
Harry Potter and the Sorcerer's Stone
The Pilgrim's Progress
Wireless Hacks
Flash Hacks. 100 Industrial-Strength Tips & Tools
PayPal Hacks. 100 Industrial-Strength Tips and Tools
Amazon Hacks
Pdf Hacks
The Da Vinci Code
Google Hacks
The Holy Bible
Windows XP For Dummies
Harry Potter and the Half-Blood Prince
Seo Book
Upgrading and Repairing Networks
Macromedia Dreamweaver 8 UNLEASHED
Windows XP Annoyances
Windows XP Hacks
Microsoft Windows XP Power Toolkit
Teach Yourself MS Office In 24Hours
iPod & iTunes Missing Manual
PC Hacks 100 Industrial-Strength Tips and Tools
PC Overclocking, Optimization, and Tuning - 2th Edition
PC Hardware In A Nutshell 3rd Edition
PC Hardware in a Nutshell, 2nd Edition
Upgrading and Repairing PCs
Google for Dummies
MySQL Cookbook
Teach Yourself Macromedia Flash 8 In 24 Hours
PHP CookBook
Sams Teach Yourself JavaScript in 24 Hours
PHP5 Manual
Free Games Paper Airplanes
500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele