Re: Multi-Sort -- how to do this?

From: Date: Thu, 18 Jun 2009 17:04:30 +0000
Subject: Re: Multi-Sort -- how to do this?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-294269@lists.php.net to get a copy of this message
Ash:
You missed the point. I could use the built-in sort (i.e., sort() ) and sort the $d array. However, I would like the indexes of the other arrays to match the new sort. Cheers,
tedd I think I might need a for-instance here, as you lost me! Thanks Ash
Ash: You can sort any array by using the "built-in" php function sort() -- try it. After you try it, you'll find that the array is sorted but the order of the values are not as they were before. In other words, the index-value pairs are different. Here's an example: http://www.webbytedd.com/bbbb/sort/ Before the sort, the value 'red' is located in the $a array under index 0 After the sort, the value 'red' is still in the $a array but under index 2. Note, the values of the indexes have changed. My query was simply how to sort one array (order it) while ordering the values of other arrays in the same manner. The multisort() function does that as seen here: http://www.webbytedd.com/bbbb/multisort/ Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#294269) next »