Alternative Syntax For Control Structures
PHP offers an alternative syntax using colons rather than the standard curly-brace syntax (of "{...}"). This syntax affects the following control structures: if, while, for, foreach, and switch. The syntax varies only slightly from the curly-brace syntax. In each case the opening brace ({) is replaced with a colon (:) and the close brace is replaced with endif;, endwhile;, endfor;, endforeach;, or endswitch;, respectively. Mixing syntax styles within the same control block is not supported. An example of the syntax for an if/elseif statement is as follows:
if (condition) : // code here elseif (condition) : // code here else : // code here endif;Read more about this topic: PHP Syntax And Semantics
Famous quotes containing the words alternative, control and/or structures:
“No alternative to the
one-man path.”
—Denise Levertov (b. 1923)
“All industries are brought under the control of such people [film producers] by Capitalism. If the capitalists let themselves be seduced from their pursuit of profits to the enchantments of art, they would be bankrupt before they knew where they were. You cannot combine the pursuit of money with the pursuit of art.”
—George Bernard Shaw (18561950)
“It is clear that all verbal structures with meaning are verbal imitations of that elusive psychological and physiological process known as thought, a process stumbling through emotional entanglements, sudden irrational convictions, involuntary gleams of insight, rationalized prejudices, and blocks of panic and inertia, finally to reach a completely incommunicable intuition.”
—Northrop Frye (b. 1912)