Re: [PHP] sorting in array

2006-08-03 Thread Richard Lynch
try2 = $b['country']; >> >> if($country1=='') return 1; >> else return ($country1 < $country2) ? -1 : 1; >> >>} >> >> -----Original Message- >> From: weetat [mailto:[EMAIL PROTECTED] >> Sent: Monday, J

Re: [PHP] sorting in array

2006-07-31 Thread David Tulloh
weetat wrote: > Hi all , > > I have array value as shown below, i have paste my test php code below: > I have problem when doing usort() when 'country' = '', i would like to > display records where country = '' last. Any ideas how to do that ? > ... You might try searching the list's archive's.

RE: [PHP] sorting in array

2006-07-31 Thread Peter Lauri
Sent: Monday, July 31, 2006 1:57 PM To: php-general@lists.php.net Subject: Re: [PHP] sorting in array At 10:31 PM 7/30/2006, weetat wrote: > I have problem when doing usort() when 'country' = '', i would > like to display records where countr

RE: [PHP] sorting in array

2006-07-31 Thread Peter Lauri
; Paul Novitski Cc: php-general@lists.php.net Subject: Re: [PHP] sorting in array Thanks Paul, Very weird tried Peter's option, it doesn't work. Btw , how to sort by ascending ? Thanks Paul Novitski wrote: > At 12:22 AM 7/31/2006, Paul Novitski wrote: >> I could make th

Re: [PHP] sorting in array

2006-07-31 Thread Paul Novitski
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:

Re: [PHP] sorting in array

2006-07-31 Thread weetat
Thanks Paul, Very weird tried Peter's option, it doesn't work. Btw , how to sort by ascending ? Thanks Paul Novitski wrote: At 12:22 AM 7/31/2006, Paul Novitski wrote: I could make that last statement just a bit simpler: function cmpcountry($a, $b) { $country1 = ($a['country

RE: [PHP] sorting in array

2006-07-31 Thread Paul Novitski
At 12:22 AM 7/31/2006, Paul Novitski wrote: I could make that last statement just a bit simpler: function cmpcountry($a, $b) { $country1 = ($a['country'] == '') ? "zzz" : $a['country']; $country2 = ($b['country'] == '') ? "zzz" : $b['country']; return ($count

RE: [PHP] sorting in array

2006-07-31 Thread Paul Novitski
At 05:40 PM 7/30/2006, Peter Lauri wrote: function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; if($country1=='') return 1; else return ($country1 < $country2) ? -1 : 1; } Good call, Peter; my suggestion was unne

Re: [PHP] sorting in array

2006-07-30 Thread Paul Novitski
At 10:31 PM 7/30/2006, weetat wrote: I have problem when doing usort() when 'country' = '', i would like to display records where country = '' last. Any ideas how to do that ? ... $arraytest= array( array ( 'country' => '', ) , array (

Re: [PHP] sorting in array

2006-07-30 Thread weetat
untry2) ? -1 : 1; } -Original Message- From: weetat [mailto:[EMAIL PROTECTED] Sent: Monday, July 31, 2006 12:32 PM To: php-general@lists.php.net Subject: [PHP] sorting in array Hi all , I have array value as shown below, i have paste my test php code below: I have problem when doin

RE: [PHP] sorting in array

2006-07-30 Thread Peter Lauri
IL PROTECTED] Sent: Monday, July 31, 2006 12:32 PM To: php-general@lists.php.net Subject: [PHP] sorting in array Hi all , I have array value as shown below, i have paste my test php code below: I have problem when doing usort() when 'country' = '', i would like to display

[PHP] sorting in array

2006-07-30 Thread weetat
Hi all , I have array value as shown below, i have paste my test php code below: I have problem when doing usort() when 'country' = '', i would like to display records where country = '' last. Any ideas how to do that ? Thanks $arraytest= array( array ( 'country'