Alternative Syntax¶
PHP offers an alternative syntax for some of its control structures; namely, if, while, for, foreach, and switch. In each case, the basic form of the alternate syntax is to change the opening brace to a colon : and the closing brace to endif;, endwhile;, endfor;, endforeach;, or endswitch;, respectively.
<?php if ($a == 5): ?>
A is equal to 5
<?php endif; ?>
See also Using Alternative Syntax for Control Structures in PHP to Enhance HTML Integration.
Related : Control Structures, Bracketless