O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites by Leon Atkinson

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 3. CONTROL STATEMENTS

Topics in This Chapter

  • True and False

  • The if Statement

  • The ? Operator

  • The switch Statement

  • Loops

  • The while Statement

  • The break Statement

  • The do...while Statement

  • The for Statement

  • The foreach Statement

  • exit, die, and return

  • Evaluation of Boolean Expressions

Control statements allow you to execute blocks of code depending on conditions. They also allow you to repeat a block of code, which leads to simpler, more efficient scripts. This chapter will introduce you to the decision-making statements if and switch. You will also learn about loops using for and while.

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