|
|
|
|
|
by TeMPOraL
3475 days ago
|
|
Note than in PHP you can also rewrite it as: <?php foreach($list as $item) { ?>
<li><?= $item['name'] ?></li>
<?php } ?>
Or with shortened PHP tags and alternative control structure syntax: <? foreach($list as $item): ?>
<li><?= $item['name'] ?></li>
<? endforeach; ?>
Which at this point just differs in delimiters (<? and ?> instead of { and }) from the template language.I don't have an opinion on this "more human way" to express oneself, but it seems that it would connect this case with the reason people seem to prefer curly braces to parenthesis in code too. |
|