RE: [PHP] sort multidimension array

2006-06-22 Thread Ford, Mike
On 22 June 2006 02:22, weetat wrote: > Hi all, > > I have multi-arrays as shown below: > I implemented usort() to sort the array by 'country' field > in the array. > However there some empty string value in the array and i setup my > cmpcountry() function to sort array, however , some count

Re: [PHP] sort multidimension array

2006-06-21 Thread weetat
Hi David , Thanks for your input, it solve my problem. David Tulloh wrote: Examine your function for the case of cmpcountry("Thailand", ""); if($country2 == '') is true if($country1 < $country2) is false Then ($country1 < $country2) is false again and 1 is returned. This means that "" is

Re: [PHP] sort multidimension array

2006-06-21 Thread David Tulloh
Examine your function for the case of cmpcountry("Thailand", ""); if($country2 == '') is true if($country1 < $country2) is false Then ($country1 < $country2) is false again and 1 is returned. This means that "" is less than "Thailand", and should be sorted higher. The easiest way to fix this is