title: More concise ternary expression?
body: <p>I often find myself needing to write code with the following logical pattern:</p>
  
  <pre><code>$foo = isset($bar) ? $bar : $baz;
  </code></pre>
  
  <p>I know about the <code>?:</code> syntax:</p>
  
  <pre><code>$foo = $bar ?: $baz;
  </code></pre>
  
  <p>...which, on the surface, appears to be what I'm looking for; however, it throws an undefined notice index when <code>$bar</code> is not set.  It also uses the same logic as <code>empty()</code>, meaning that "empty" values like <code>FALSE</code>, <code>0</code>, <code>"0"</code>, etc. don't pass.  Hence, it's not really equivalent.</p>
  
  <p>Is there a shorter way of writing that code without throwing a notice when <code>$bar</code> is not set?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>To make it a bit more clear <em>why</em> I'm looking for a shortcut syntax, here's a better example:</p>
  
  <pre><code>$name = isset($employee-&gt;getName())
        ? $employee-&gt;getName()
        : '&lt;unknown&gt;';
  </code></pre>
  
  <p>In this case, <code>$employee</code> might be an object from a 3rd-party library, and it might be a valid scenario that its <code>name</code> might be <code>NULL</code>.  I'd like to set variable <code>$name</code> to the returned name (if there is one), but some sensible default if there isn't.</p>
  
  <p>If the method call is more complex than just a getter, then the example becomes even more verbose, since we have to cache the result:</p>
  
  <pre><code>$bar = $some-&gt;reallyExpensiveOperation();
  $foo = isset($bar) ? $bar : $baz;
  </code></pre>