Conditional Structures

Conditional structures describe the if-then, if-then-else, if-then-else-if-then-else, and switch statements. These structures enable you to make decisions based on single variables or collections of variables.

It is important to note that PHP provides conditional structured Boolean statements with a great deal of flexibility and power, which can be used well or poorly. As discussed previously, a Boolean evaluation returns true for any nonzero number or nonempty string and false for zero or an empty string. If you cast a variable to a Boolean data type, it will have a value of 0 for false or 1 for true.

If Statement

If statements evaluate an expression or set of expressions to determine whether the expression is true or ...

Get Oracle Database 10g Express Edition PHP Web Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.