Skip to content

Instantly share code, notes, and snippets.

@phatduckk
Created February 11, 2010 19:20
Show Gist options
  • Save phatduckk/301838 to your computer and use it in GitHub Desktop.
Save phatduckk/301838 to your computer and use it in GitHub Desktop.
<?php
$users = someshit($someVar);
?>
<div class="bla">
<? foreach ($users as $u) : ?>
<div>
<?= $u['username'] ?> from <?= $u['location'] ?>
<? if (is_band($u['id'])) :?>
<?= $u['profile']['genre'] ?>
<? endif; ?>
</div>
<? endforeach; ?>
</div>
vs:
<div class="bla">
<?php
foreach ($users as $u) {
?>
<div>
<?php
echo $u['username']
?>
from
<?php
echo $u['location']
if (is_band($u['id'])) {
echo $u['profile']['genre'] ?>
}
?>
</div>
<?php
}
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment