usort() /uksort()/uasort()
look here :
http://www.php.net/manual/en/function.uasort.php
There is an example in the user notes.
Andrey
- Original Message -
From: SED [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 12, 2002 7:25 PM
Subject: [PHP] How to sort by 3rd row in an
Hi,
I'm trying to sort an array like following
myArray[1][firstname] = Joe;
myArray[1][lastname] = Smith;
myArray[1][company] = Bullock;
myArray[1][email] = [EMAIL PROTECTED];
myArray[2][firstname] = Jim;
myArray[2][lastname] = Cords;
myArray[2][company] = Jamen;
myArray[2][email] = [EMAIL
This is a terribly inneficient way of handling your situation but I believe
it would work.
// First we're going to make a list of all company values
for($i=0; $icount($myarray); $i++)
{
$company_values[] = $myarray[$i][company];
}
// Then we're going to order the array using a standard
Or try the usort() function?
?php
...
myArray[1][firstname] = Joe;
myArray[1][lastname] = Smith;
myArray[1][company] = Bullock;
myArray[1][email] = [EMAIL PROTECTED];
myArray[2][firstname] = Jim;
myArray[2][lastname] = Cords;
myArray[2][company] = Jamen;
myArray[2][email] = [EMAIL PROTECTED];
4 matches
Mail list logo