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

Reply via email to