From: =?UTF-8?Q?Hans_=C3=85hlin?= on
Try this insted

array(
[0]=>array( [0]=>75, [1] => Personal Email)
[1]=>array( [0]=>31, [1] => Personal Phone)
[2]=>array( [0]=>31, [1] => Web site)
[3]=>array( [0]=>31, [1] => Text Message)
[4]=>array( [0]=>40, [1] => USPS mail)

MvH / Hans Åhlin
Tel: +46761488019
http://www.kronan-net.com/
irc://irc.freenode.net:6667 - TheCoin



2010/4/7 tedd <tedd(a)sperling.com>:
> Hi gang:
>
> Here's the problem -- I want to sort and combine two arrays into one sorted
> array. Here's a real-world example:
>
> Array 1
> (
>    [1] => 75
>    [2] => 31
>    [3] => 31
>    [4] => 31
>    [5] => 40
> )
>
> Array 2
> (
>    [1] => Personal Email
>    [2] => Personal Phone
>    [3] => Web site
>    [4] => Text Message
>    [5] => USPS mail
> )
>
> After the operation, I want this:
>
> Array
> (
>    [75] => Personal Email
>    [40] => USPS mail
>    [31] => Personal Phone
>    [31] => Web site
>    [31] => Text Message
> )
>
> Note: This is a descending-sort of Array 1 while being coupled to index of
> Array 2. In other words, the order of Array 2 depends upon the order of
> Array 1 -- the two arrays are coupled.
>
> I've solved this problem, but my solution is pretty lame. There has to be a
> better/slicker way.
>
> Suggestions?
>
> Cheers,
>
> tedd
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>