View Full Version : Multi-dimentional array sorts

03-06-2009, 07:57 PM
I have 2 associative arrays, "hostids" and "hardware". Here are code snippets to show the structure:



I want to sort the hostids array based on the alphabetic name from the hardware array. If necessary I can ensure that the 2 arrays have the same hostid keys but it would be even better if it handled a situation where a hostid was missing from one of the arrays. Is this just too convoluted?

03-06-2009, 08:13 PM
You're looking for array_multisort() (http://www.php.net/manual/en/function.array-multisort.php).