In cases like expressions using the altering syntax, I do not use the ;.
Example:
<?php foreach($array as $value) : ?>
<?php endforeach ?>
Some programmer friends criticized the lack of ; after the endif, but I’m sure no one would use a ; after the closure of a if common.
Thus:
<?php if ($x) { ?>
<?php }; ?>
I believe you’re referring, in your question, to expressions, as a echo simple, or a function call.
It is highly recommended to use the ; in such cases.
I often look at the source code of frameworks, so I can try to improve my coding pattern. And by looking at the source code of the Laravel 4, I could see what he does when using the Blade syntax.
Example of a Blade code:
Meu nome é {{ $nome }} e tenho {{ $idade }} anos
Blade compiles the code that way:
Meu nome é <?php echo $nome; ?> e tenho <?php echo $idade; ?>
Then we realized that this framework was concerned with putting the ; at the end of the expression.
Hello, thank you, would you have any sources to confirm your answer? for me is the one who best explained, with a reliable source I can mark this response as the best.
– igrossiter