I have an array that I would like to sort based on its values. However, because values can be equivalent, I need to be able to access the keys in the sort function's callback as well in order to figure out the correct ordering. I am currently using uasort in order to sort by value, while maintaining key association, but cannot figure out how to access the keys from the callback comparison function.
Example array:
Array(
[a1] => date1,
[a2] => date2,
[a3] => date1
)
I need to sort by the dates, but since a1 and a3 are the same date, I need to check whether it's a1 or a3.