Chapter 6. Flow Control Functions in PHP

In this chapter, you learn the following:

How to use the if statement to execute code if a test expression evaluates to true

How to execute alternative blocks of code when the test expression of an if statement evaluates to false

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 start and end tags within control structures

The scripts created in the previous chapter flow only in a single direction: forward. That is, the same statements execute in the same order ...

Get Sams Teach Yourself PHP, MySQL® and Apache All in One, Fifth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.