In PHP have an alternative syntax for if, while, for, foreach, and switch. 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.
Syntax :
for (initial; condition; increment) :
Program will execute if condition is true;
endfor;
<?php
$i = 1;
for($i=0;$i<=4;$i++) :
echo $i;
endfor;
?>
Output : 1 2 3 4 .