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:
“If you have abandoned one faith, do not abandon all faith. There is always an alternative to the faith we lose. Or is it the same faith under another mask?”
—Graham Greene (19041991)
“Why wont they let a year die without bringing in a new one on the instant, cant they use birth control on time? I want an interregnum. The stupid years patter on with unrelenting feet, never stoppingrising to little monotonous peaks in our imaginations at festivals like New Years and Easter and ChristmasBut, goodness, why need they do it?”
—John Dos Passos (18961970)
“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)