Re: sorting an array
| From: | Mark | Date: | Tue, 17 Jun 2003 16:17:20 +0000 |
| Subject: | Re: sorting an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151857@lists.php.net to get a copy of this message | ||
perhaps asort()?
"This function sorts an array such that array indices maintain their
correlation with the array elements they are associated with."
--- Diana Castillo <diana@interhotel.com> wrote:
> Hi , I am trying to sort this:
> array[numrooms] => Array ( [3] => 2 [2] => 5 [1] => 1 )
> I want to get a result like this:
> 2=>5
> 3=>2
> 1=>1
> ( I want the keys to stay attached to the results)
>
> I used this to sort it :
> array_multisort ($request_array['numrooms'], SORT_NUMERIC,
> SORT_DESC);
>
> but instead I get this:
> [numrooms] => Array ( [0] => 5 [1] => 2 [2] => 1 )
>
> any suggestionis?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
=====
Mark Weinstock
mark_weinstock@yahoo.com
***************************************
You can't demand something as a "right" unless you are willing to fight to death to
defend everyone else's right to the same thing.
***************************************
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com