title: Coalesce for arrays with PHP
body: <p>Coalesce isn't really the right word as it returns the first non-NULL value, but hopefully it conveys the intent.</p>
  
  <p>Is there a more-readable and concise way to do get the first defined value of <code>foo</code> from <code>$arr</code>, <code>$_GET</code>, and then <code>$_POST</code>?</p>
  
  <pre><code>function foo($arr=array())
  {
     $arr['bar']=isset($arr['bar'])?$arr['bar']:(isset($_GET['bar'])?$_GET['bar']:(isset($_POST['bar'])?$_POST['bar']:NULL));
     //  ....
  }
  </code></pre>