...

View Full Version : Multi-dimentional array sorts



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

$hostids[$hostid][date]=$date;

$hardware[$hostid][name]=$name;

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?

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum