August 2000
Intermediate to advanced
800 pages
13h 15m
English
PHP offers an abbreviated version of the if statement which borrows syntax from C. It uses the question mark as a tertiary operator. Figure 3-2 outlines the format.
|
|
The conditional expression is evaluated to be either true or false. If true, the expression between the question mark and the colon is executed. Otherwise, the expression after the colon is executed. The following code fragment
($clientQueue > 0) ? serveClients() : cleanUp();
does ...
Read now
Unlock full access