Answer the question
In order to leave comments, you need to log in
Which style is better to use in noodles?
Good afternoon, I can not decide which is better, this:
<div class = "items">
<?foreach ($items as $item):?>
<span class = "items__item"><?=$item['name']?></span>
<?if (isset($item['if'])):?>
<span class = "if-span"><?=$item['if']?></span>
<?endif;?>
<?endforeach?>
</div>
<div class = "items"><?
foreach ($items as $item) {
?><span class = "items__item"><?=$item['name']?></span><?
if (isset($item['if'])) {
?><span class = "if-span"><?=$item['if']?></span><?
}
}
?></div>
Answer the question
In order to leave comments, you need to log in
Can you give at least one argument in defense of the second option? Here is the answer.
Blocks of control structures are easily folded and unfolded with hotkeys. In addition to this, paired curly braces are highlighted by the editor.
But the alternative syntax highlighting still does not work in PhpStorm, and you have to look for paired if-endifs with your eyes.
Well, and, for fun, try using an alternative syntax for switch - this is a carefully charged rake.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question