Re: [PHP] Sort Array not working

2007-01-09 Thread Fredrik Thunberg
Hi sort returns a bool, the sorted array passed by reference. So try: $result = sort( $array ); //Now $array is sorted print_r( $array ); /Fredrik Thunberg Kevin Murphy skrev: I'm having trouble sorting an array. When I do, it empties the array for some reason. Take the following code: $d

Re: [PHP] Sort Array

2006-07-18 Thread Miles Thompson
At 10:51 AM 7/18/2006, weetat wrote: Hi I have the array below : How to sort the array by "Model" and "Country? Thanks array( "TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"), "TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"), "TBA0123459" => array("Countr

RE: [PHP] Sort Array

2006-07-18 Thread Jay Blanchard
[snip] Jay Blanchard wrote: > [snip] > I have the array below : How to sort the array by "Model" and "Country? > > Thanks > > array( > >"TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"), >"TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"), >"TBA0123459" =>

Re: [PHP] Sort Array

2006-07-18 Thread Jochem Maas
Jay Blanchard wrote: > [snip] > I have the array below : How to sort the array by "Model" and "Country? > > Thanks > > array( > >"TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"), >"TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"), >"TBA0123459" => array("

Re: [PHP] Sort Array

2006-07-18 Thread Andrew Brampton
ECTED]> To: "weetat" <[EMAIL PROTECTED]>; Sent: Tuesday, July 18, 2006 3:17 PM Subject: RE: [PHP] Sort Array [snip] I have the array below : How to sort the array by "Model" and "Country? Thanks array( "TBA0123456" => array("Count

RE: [PHP] Sort Array

2006-07-18 Thread tg-php
Actually it's going to be a little more complicated than a 'ksort' here I think. ksort on the main array is going to give you: array ( "TBA0123451" => array("Country"=>"Germany","Model"=>"WS6234"), "TBA0123452" => array("Country"=>"England","Model"=>"WS1234"), "TBA0123456" => array("Coun

RE: [PHP] Sort Array

2006-07-18 Thread Jay Blanchard
[snip] I have the array below : How to sort the array by "Model" and "Country? Thanks array( "TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"), "TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"), "TBA0123459" => array("Country"=>"Vietnam","Model"=>"WS7234"),

Re: [PHP] Sort Array by date

2003-12-04 Thread Curt Zirzow
* Thus wrote Matt Palermo ([EMAIL PROTECTED]): > I have a bunch of dates in the form: MM-DD- in an array and I want to > sort them and display them in descending order. I have tried the usort() > function below and it's not working. Can anyone help me out here? > > $menu_item = array(); > $m

RE: [PHP] Sort Array by date

2003-12-04 Thread Martin Towell
Hiya, I changed your date_file_sort() function so it echos a few things function date_file_sort($a, $b) { echo "$a - $b - "; $a = strtotime($a); $b = strtotime($b); echo "$a - $b - ".date("d-M-Y", $a)." - ".date("d-M-Y", $b)."\n"; return strcmp($a, $b); } "interesting" result