The array_multisort function in php allows you to sort several arrays at the same time. How it works is:
- Sort first array by key value (depending on arguments)
- If there are any identical keys in the first array, sort these by the keys in the second array (assuming it is specified)
The documentation for this isn’t particularly clear.