PHP Syntax and Semantics - Alternative Syntax For Control Structures

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)

    America is not so much a nightmare as a non-dream. The American non-dream is precisely a move to wipe the dream out of existence. The dream is a spontaneous happening and therefore dangerous to a control system set up by the non-dreamers.
    William Burroughs (b. 1914)

    If there are people who feel that God wants them to change the structures of society, that is something between them and their God. We must serve him in whatever way we are called. I am called to help the individual; to love each poor person. Not to deal with institutions. I am in no position to judge.
    Mother Teresa (b. 1910)