title: usort - more parameters
body: <p>Hallo, how can I pass more parameters to usort? 
  I have different functions, which are very similar in structure, I want to have just one function:</p>
  
  <pre><code>&lt;?php
  
       $arr = array(      array('number' =&gt; 100, 'string'=&gt;'aaa'),
                  array('number'=&gt;50, 'string'=&gt;'bdef'),
                  array('number'=&gt;150, 'string'=&gt;'cbba')
              );
  
  
      usort($arr,  'sortNumberDesc');
  
      //How can I use just a single function?
      //How can I pass further parameters to usort?
  
      function sortNumberDesc($a, $b){
         $a = $a['number'];
         $b = $b['number'];
         if ($a == $b) return 0;
         return ($a &gt; $b) ? -1 : +1;
      }
  
      function sortNumberAsc($a, $b){
         $a = $a['number'];
         $b = $b['number'];  
         if ($a == $b) return 0;
         return ($a &lt; $b) ? -1 : +1;
      }
  
      //I want to do the same with just one function:
      //Sort ID is the search index, reverse DESC or ASC 
      function sort($a, $b, $sortId='number', $reverse = 0){
         $a = $a[$sortId];
         $b = $b[$sortId]; 
         if ($a == $b) return 0;
         if($reverse == false) return ($a &gt; $b) ? -1 : +1;
         else return ($a &lt; $b) ? -1 : +1;
      }
  
      print_r($arr);
  ?&gt;
  </code></pre>