PHP has a slightly underused alternative syntax for control structures, which generally is more effective in template files than the standard block-style code.
If
if ($a == 5): statement … elseif ($a == 6): statement … else: statement … endif;
While
while (expr): statement ... endwhile;
For
for (expr1; expr2; expr3): statement ... endfor;
Foreach
foreach ( expr as key = value ) : statement … endforeach;
With modern MVC architectures, clear separation of presentation and logic is advisable for a number of reasons, one of which is the empowerment of designers and frontend developers to modify the UI without the need to understand the code. Using this alternative syntax is a small way to encourage coders to achieve this.
Further, naming a PHP template file a .phtml file, rather than .php, and only including the alternative syntax in such files, helps developers to identify and make a distinction on the type of file it is and its purpose. It reminds us to not put too much functionality into the template files.
Personally, I have never really understood the use of proprietary languages for template engines; at a low level, PHP is pretty straight forward to pick up for designers and frontend developers, and using PHP’s alternative syntax makes it just a little bit easier.