O'Reilly logo

PHP for Teens by Maneesh Sethi

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

Branching Structures

Control structures include branching structures, which allow your program to make all these things:

  • if. . .then decisions

  • Loops, which let you execute some code repeatedly

  • Functions that put specialized code into their own separate section

When you run a program, you expect it to go from beginning to end. Usually, the program displays everything that is in the code, putting each section one after another. When you write an HTML page, every part of the page is displayed in the same order as it is defined in the source. However, you might want to change that flow. You might need to perform a different action because some special event occurs. PHP offers a way to do this with branching structures.

if

The easiest way is to use ...

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