Chapter 5. Flow Control Functions in PHP
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 allow for much flexibility.
You will now look at some structures that enable your scripts to adapt to circumstances. In this hour, you will learn
How to use the
if
statement to execute code if a test expression evaluates totrue
How to execute alternative blocks of code when the test expression of an
if
statement evaluates tofalse
How to use the
switch
statement to execute code based on the value returned by a test expressionHow to repeat execution of code using a
while
statementHow to use
for
statements to make neater loopsHow to break out of loops ...
Get Sams Teach Yourself PHP, MySQL™ and Apache in 24 Hours now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.