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:
$referencePlace = fetchReferencePlace();
$relevantPlaces = fetchRelevantPlaces();
usort($relevantPlaces, sortByDistance($a, $b, $referencePlace));
Note: This question is a duplicate of: Pass extra parameters to usort callback