Re: [PHP] Multi-Sort -- how to do this?
[email protected] (Daniel Brown)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jun 17, 2009 at 17:11, tedd<[email protected]> wrote: > Hi gang: > [snip!] > > Is there a slick way to do that? Hacked together in the two minutes before I go to bed, so don't complain about its inelegance. ;-P <?php $a = array('apple', 'banana', 'grape', 'orange'); $b = array(100, 2111, 198, 150); $c = array('red', 'yellow', 'purple', 'orange'); $d = array(100, 300, 11, 50); for($i=0;$i<count($d);$i++) { $e[$d[$i]]['a'] = $a[$i]; $e[$d[$i]]['b'] = $b[$i]; $e[$d[$i]]['c'] = $c[$i]; } ksort($e); print_r($e); ?> -- </Daniel P. Brown> [email protected] || [email protected] http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000