title: Sorting array in PHP with user defined function and reference value
body: <p>I want to sort the elements in an array (containing latitude and longitude) in comparison to some reference points latitude and longitude. (By distance) The reference point is known just right before calling the sort function.
  Is there any way to enter three parameters in the callback-function of the usort() function or do I need to write me own complete sort function?
  My plan was something like that:</p>
  <pre><code>$referencePlace = fetchReferencePlace();
  $relevantPlaces = fetchRelevantPlaces();
  usort($relevantPlaces, sortByDistance($a, $b, $referencePlace)); 
  </code></pre>
  <p>Note: This question is a duplicate of: <a href="https://stackoverflow.com/questions/8230538/pass-extra-parameters-to-usort-callback/">Pass extra parameters to usort callback</a></p>