Chapter 6. Control Structures
Now that you understand the basics of the variable types (aside from arrays, which will be discussed in Chapter 7, “Using Arrays”), let’s get into the real meat of programming—control structures (conditionals and loops). In the process, this chapter finishes the discussion of PHP’s various operators. (You’ve already seen the arithmetic and assignment operators in the previous chapters.)
Conditional structures are a staple of programming languages. PHP includes two general conditionals—if
and switch
—both of which you’ll begin using in this chapter. They allow you to define a question and then perform actions based on the answer. This functionality gives you the ability to make your Web sites even more dynamic. The discussion ...
Get PHP for the World Wide Web, Second Edition: Visual Quickstart Guide 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.