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
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
[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" =>
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("
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
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
[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"),
* 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
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
9 matches
Mail list logo