Problem:
I need to sort an numeric array by its distance to an given value. Meaning the numbers closest to the given value, should come first. Performance is not a must, but still appreciated.
Example:
Given I have an array $array = array(1000, 1050, 1100, 1125);
.
mySortFunction($array, 1090);
should result in array(1100, 1125, 1050, 1000)