I have no idea why people recommend to mix PHP and HTML like this:

<article>
  <?php if (true) : ?>
    <div>
      <?php echo "Something"; ?>
    </div>
  <?php endif; ?>
</article>
<article>
      <div>
      Something    </div>
  </article>

I often do this:

<article><?php
  if (true) :
    ?><div><?php
      echo "Something";
    ?></div><?php    
  endif;
?></article>
<article><div>Something</div></article>

Let’s not talk about PHP short echo syntax or indentation here. It might look more readable but, personally, the recommended style have two problems:

  1. Increases page size with redundant whitespaces if rendered pages are not minified. Even if minified, it needs extra processes on the back-end.

  2. Confuses front-end developers with anonymous whitespaces.

For example:

<form action="" method="post">
<?php if (true) : ?>
  <input type="text" name="input" value="">
<?php endif; ?>
  <input type="submit" name="submit" value="Submit">
</form>

Now, it’s impossible to remove the whitespace between the text box and the submit button properly with CSS alone. Negative left margin, huh?