Re: Multi-Sort -- how to do this?
| From: | Daniel Brown | Date: | Thu, 18 Jun 2009 02:02:11 +0000 |
| Subject: | Re: Multi-Sort -- how to do this? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-294206@lists.php.net to get a copy of this message | ||
On Wed, Jun 17, 2009 at 17:11, tedd<tedd@sperling.com> 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>
daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000