pizzaguy Posted May 5, 2009 Share Posted May 5, 2009 does array_multisort() sort the arrays given individually or does it sort the first array and then sort the additional arrays based on the first array? If the latter is false, how would i achieve that? I have two arrays and i want to sort the first one, and then have the second one be sorted into the same order.for example:array("b","d","c","a");array("tom","cat","car","Peter Griffin");gets sorted to:array("a","b","c","d");array("Peter Griffin","tom","car","cat"); Link to comment Share on other sites More sharing options...
justsomeguy Posted May 5, 2009 Share Posted May 5, 2009 It should do what you want, check example 1 on this page:http://www.php.net/manual/en/function.array-multisort.php Link to comment Share on other sites More sharing options...
pizzaguy Posted May 5, 2009 Author Share Posted May 5, 2009 thanks. Although, i decided to use array_combine to make one array the keys, and the other array the values, with asort(), then i used array_keys() to get the sorted array. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.