PHP比较常见的循环是这样:
for($i = 0; $i < 5; $i++)
{
echo $i . "\r\n";
}
但今天却才发现其实PHP中也支持类似VB风格的语法:
for($i = 0 ; $i < 5; $i++):
echo $i . "\r\n";
endfor;
if(true):
echo 'good';
endif;
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.
这种语法由于和html的相似性,所以在模板引擎中比较多见
