e($condition, $a, $b = null)

Echos one of two alternatives depending on a condition (Shortcut for ecco())

  • $condition (mixed)
  • $a (mixed)
    Echoed if $condition is true
  • $b (mixed)
    Echoed if $condition is false

Example

With two options

e(1 == 2, 'hell freezes over', 'everything is ok');
// will most definitely echo 'everything is ok'

With a single option

<ul>
  <?php foreach($pages as $p): ?>
  <li<?php e($p->isActive(), ' class="active"') ?>>
    …
  </li>
  <?php endforeach ?>
</ul>

Is something missing or incorrect? Edit this page on Github…