O'Reilly logo

Sams Teach Yourself PHP, MySQL® and Apache All in One, Fifth Edition by Julie Meloni

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required