Re: sorting in array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 01:14 AM 7/31/2006, weetat wrote:
Thanks Paul,

  Very weird tried Peter's option, it doesn't work.

  Btw , how to sort by ascending ?


Please explain what you mean. The current script DOES sort ascending by country (except for the blank country fields which are placed at the end):
http://juniperwebcraft.com/test/sortTest.php

Singapore, Singapore, Thailand is an ascending sort.

Your original code also sorted ascending by country, but with the blank countries at the front:

  function cmpcountry($a, $b)
  {
        $country1 = $a['country'];
        $country2 = $b['country'];

        return ($country1 < $country2) ? -1 : 1;
  }

Paul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux