title: PHP USort gives null warning when array is empty
body: <pre><code>    function sort_multi_array($array, $key)
  {
    if (is_null($array)) return 0;
    $keys = array();
    for ($i=1;$i&lt;func_num_args();$i++) {
      $keys[$i-1] = func_get_arg($i);
    }
  
    // create a custom search function to pass to usort
    $func = function ($a, $b) use ($keys) {
      for ($i=0;$i&lt;count($keys);$i++) {
        if ($a[$keys[$i]] != $b[$keys[$i]]) {
          return ($a[$keys[$i]] &gt; $b[$keys[$i]]) ? -1 : 1;
        }
      }
      return 0;
    };
  
    usort($array, $func);
  
    return $array;
  }
  </code></pre>
  
  <p>I'm building a simple search query however when it reaches the end i.e. no more entries in Warning: usort() expects parameter 1 to be array, null given in </p>
  
  <p>How can I test to see if the array is empty and simply return a null result before it reaches the usort line?</p>
  
  <p>thank you!</p>