Hour 5. Going with the Flow
What You'll Learn in This Hour:
How to use the if statement to execute code only when a condition is met How to execute alternative blocks of code when the condition of an if statement is not met How to use the switch statement to execute code based on the value returned by a test expression How to repeat execution of code using a while statement How to use for statements to make neater loops How to break out of loops How to nest one loop within another How to use PHP's start and end tags within control structures
The scripts created in the last hour flow only in a single direction. The same statements are executed in the same order every time a script is run. This does not leave much room for flexibility. We now will look at some structures that enable your scripts to adapt to circumstances.
 |