Re: sorting multi array
| From: | Chris Boget | Date: | Wed, 25 Apr 2007 11:48:15 +0000 |
| Subject: | Re: sorting multi array | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-253690@lists.php.net to get a copy of this message | ||
this won't work if he has the same quantity for several keys, I thinkYes, 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