PHP IF[FALSE/NULL/EMPTY] function
<p>Since a year or so I had a function in all my projects called: <code>ifNot()</code>.</p>

<p>This function is somehow a derivated from the ternary operator:</p>

<pre><code>public function ifNot( $item, $ifNot )
{
    if ( !$item ) {
        return $ifNot
    } else {
        return $item;
    }
}
// The var $foo twice
$var = ( $foo ) ? $foo : 'is empty or false =(';
// The var $foo once
$var = ifNot($foo, 'is empty or false =(');
</code></pre>

<p>In fact, Twig Template Engine use something like it:</p>

<pre><code>{{ foo ? 'yes' : 'no' }}

{# as of Twig 1.12.0 #}
{{ foo ?: 'no' }} == {{ foo ? foo : 'no' }}
{{ foo ? 'yes' }} == {{ foo ? 'yes' : '' }}
</code></pre>

<p>The question is: There is a better/known approach for this function?</p>

<p>PS: SQL also has an <code>IFNULL()</code> =)</p>
