Re: sorting in array
| From: | Paul Novitski | Date: | Mon, 31 Jul 2006 08:32:27 +0000 |
| Subject: | Re: sorting in array | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239898@lists.php.net to get a copy of this message | ||
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