PHP IF shorthand variations similar to ternary
<p>Is there another way of writing something like this?</p>

<pre><code>$var2 = ($var1) ? $var1 : 'bar';
</code></pre>

<p>Example..</p>

<pre><code>$var1 = 'foo';
$var2 = ($var1) ? $var1 : 'bar';
echo $var2; //Outputs foo

$var1 = false;
$var2 = ($var1) ? $var1 : 'bar';
echo $var2; //Outputs bar
</code></pre>

<p>I hoped</p>

<pre><code>$var2 = $var1 || 'bar';
</code></pre>

<p>would work because I thought I've seen that before but it didn't.  Any ideas?</p>

<p>Thanks!</p>
