Re: sorting multi array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



this won't work if he has the same quantity for several keys, I think

Yes, you are correct. If that is the case, then you would just need to change the following line

$tmpArray[$elArray['quantity']] = $elKey;

to

$tmpArray[$elArray['quantity']][] = $elKey;

then change logic in this loop:

foreach( $tmpArray as $elKey ) {

to handle the additional array. If additional sorting needs to occur for those keys that have the same quantity then I think recursion will be in order.

thnx,
Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux