Sorting an array of array
| From: | Didier Bringer | Date: | Fri, 08 Dec 2000 16:11:41 +0000 |
| Subject: | Sorting an array of array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-29368@lists.php.net to get a copy of this message | ||
Hello,
I am using php4 since few days, before I was in php3
Example :
Let say I have a file called data containing this
Gates Bill 10
Torvald Linus 10000
Black Joe 5
I put it in an array, with a key 1,2,3
My array is a array with two element inside, first is the key , second
is another array with the data of each line
1 => Gates Bill 10
2 => Torvald Linus 10000
3 => Black Joe 5
Let's say I want to sort by third column and obtain
1 => Black Joe 5
2 => Gates Bill 10
3 => Torvald Linus 10000
Currently I did something very complex (using temp arrays) because in
php3 only sort exists
I though that php4 was able to do that easily, but I cannot see answer
in the various sort functions in the documentation
Anyone ?
thanks in advance...
dda