Page 1 of 1

how to sort value in associative array

Posted: Sat Jul 29, 2006 2:50 pm
by destiny_cores
I have an array

Array (
  • => 2 [comput ] => 3 [vision ] => 4 [confer ] => 3 [homepag ] => 1 [includ ] => 1 [major ] => 1 [link ] => 1 [websit ] => 1 [comprehens ] => 1 [workshop ] => 1 [import ] => 1 [date ] => 1 [submiss ] => 1 [deadlin ] => 1 [maintain ] => 1 [keith ] => 1 [price ] => 1 )

    if I want to sort value from max to min such as

    [vision]=4
    [comput]=3
    [confer]=3
    • =2
      .
      .
      .
      [price]=1

      How should I do ?

      Thanks.

Posted: Sat Jul 29, 2006 2:52 pm
by Benjamin

Code: Select all

asort();
ksort();

Posted: Sat Jul 29, 2006 2:56 pm
by feyd
Please be aware we have policies covering vague and ambiguous thread titles. This is a friendly reminder only.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.

Posted: Sat Jul 29, 2006 3:23 pm
by destiny_cores
I 'm sorry Feyd