sorting a multidimensional array
| From: | michel guilhem | Date: | Wed, 20 Dec 2000 11:45:15 +0000 |
| Subject: | sorting a multidimensional array | ||
| Groups: | php.pear | ||
| Request: | Send a blank email to php-pear+get-724@lists.php.net to get a copy of this message | ||
I try to sort an array called $info which is tridimensional , the first
value is the number of elements , the second value is used for the sort
( name of the variable ) and the third is a positionnal value for
elements multivaluated .
What can i do to sort under an element in second position without losing
the link beetwen the others elements
example
Before the sort i have
$info[0]["el"][0] = 120 and info[0]["el1"][0] = cou1
$info[1]["el"][0] = 100 and info[1]["el1"][0] = cou2
$info[2]["el"][0] = 110 and info[2]["el1"][0] = cou3
$info[3]["el"][0] = 140 and info[3]["el1"][0] = cou4
My purpose is to sort with ["el"] and the values of ["el1"] remains
linked
$info[0]["el"][0] = 100 and info[0]["el1"][0] = cou2
$info[1]["el"][0] = 110 and info[1]["el1"][0] = cou3
$info[2]["el"][0] = 120 and info[2]["el1"][0] = cou1
$info[3]["el"][0] = 140 and info[3]["el1"][0] = cou4
What can i do ?
any clue is wellcome .
Guilhem michel