Chapter 4. Controlling the Flow of the Script
Change the Order of Statement Execution
PHP scripts are a series of instructions in a file. PHP begins at the top of the file and executes each instruction in order. Sometimes you want your statements to execute in a different order, such as executing a statement only when certain conditions exist or executing a statement more than once. PHP provides several complex statements that change the order of execution in your script.
Conditional Statements
Conditional statements execute a block of statements only when certain conditions are met. The most common conditional statement is the if
statement, which tests a condition and executes a block of code when the condition is true. An if
statement can also ...
Get PHP & MySQL®: Your visual blueprint™ for creating dynamic, database-driven Web sites 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.