[main] [misc] [graphics] [page design] [site design] [xhtml] [css] [xml] [xsl] [schema] [javascript] [php] [mysql]

HVCC Home
Blackboard HVCC
Blackboard Manual
Faculty Association

php main
1. what is php
2. http basics
3. php basics
4. php expressions
5. php client side
* 6. php flow control
a. php conditionals
b. php adv conditions
c. php iteration
d. php functions
e. php adv functions
f. php modularity
7. php manual


print version

Note that all external links will open up in a separate window.

This is a stripped down version of these pages for older browsers. These pages are really meant to be viewed in a standards compliant browser.

Directions for surfing with audio.

Flow Control

These tutorials are about PHP and its use for server-side Web programming.

This tutorial has six (6) sub-sections.

Flow Control and Iteration

Flow control and iteration are two very useful features of most programming languages. Without them all programs would have to be linear and if you wanted something to happen three times, you would have to code it three times.

Flow control means exactly what it sounds like it should, controlling the flow of something. When using flow control for programming, what you are doing is regulating the order in which the code is executed, how many times it is executed, and if it is executed at all

Programmatic flow control can be broken into three primary categories.

Conditionals
Conditionals allow us to specify wether or not to run a selected piece of code based on some prior condition. It is the first topic we will cover. It is broken into two lectures, the first is an introduction to conditionals. The second is a discussion of some of the more advanced tools available in PHP for comparing things.
Iteration
Our next topic is iteration. Iteration, also known as looping, us to specify that a piece of code be run multiple times. Depending on circumstances, that can be one or more or zero or more times.
Functions
Our last primary flow control tool is functions. Functions allow us to create named blocks of code to be called by name elsewhere in the script. This allows us to run a piece of code multiple times from multiple places in the script. It is also the first step to writing good, modular code. This section contains both a brief introduction to functions and a more detailed look at advanced function topics in PHP.

There is one last type of flow control, called goto's, after the command that defined the process. Even if languages still support this coding mechanism, none of them will admit to it. It makes for bad code. Instead, our last topic in this section is a brief look at good coding practices as they pertain to working with effective flow control, functions and modularization.

[top]