Ford, Mike wrote:
On 17 June 2009 22:12, tedd advised:
Here's the problem. Let's say you have a collection of
arrays, such as:
$a = array();
$b = array();
$c = array();
$d = array();
And then you populate the arrays like so:
$a = ...
$b = ...
$c = ...
$d = ...
Now, let's say you want to sort the $d array, but you also want the
arrays $a, $b, and $c to be arranged in the same resultant order as
For example, please follow this:
Before sort of $d:
$a = [apple, banana, grape, orange]
$b = [100, 2111, 198, 150]
$c = [red, yellow, purple, orange]
$d = [100, 300, 11, 50]
After sort of $d:
$a = [grape, orange, apple, banana]
$b = [198, 150, 100, 2111]
$c = [purple, orange, red, yellow]
$d = [11, 50, 100, 300]
array_multisort($d, $a, $b, $c) should do what you want
That's even slicker than tedd_sort().
Application and Templating Framework for PHP
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php