RE: Array Sorting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think I may have written down my variable structure incorrectly in the
first place, which even has me confused...


The $file_array[$filename] is I don't think a further array.

The "sub" values are created as follows:
$file_array[$filename]["Date"] = ... 
$file_array[$filename]["Size"] = ...

Looking at usort, it will put the list of Dates in order (by doing a pure if
is bigger or smaller...) but will loose the link between the particular
filename and it's date properties.

Does that make sense - or am I loosing the plot?

Am I also making a mistake by not defining $file_array[$filename]?  I don't
think so, but would be happy to be corrected!

Cheers
Nunners

-----Original Message-----
From: Stut [mailto:stuttle@xxxxxxxxx] 
Sent: 04 May 2006 16:24
To: James Nunnerley
Cc: php-general@xxxxxxxxxxxxx
Subject: Re:  Array Sorting

James Nunnerley wrote:

>I've got an array which has the following properties:
>
>$file_array[$filename] = array ("Date" => $Date, "size" => $size,
>"permissions" => $permissions);
>
>I can quite happily sort the array by filename (using natksort and
>natkrsort), which I found on the php manual - and for reference have
>included as a PS!!!!
>
>What I'm not sure about doing is sorting by say Size or Date?
>
>I've again had a look through the php manual but I'm not sure how to sort
by
>a property...
>
>Can anyone point me in a direction?
>  
>

http://php.net/usort <-- it be thataway!

-Stut

PS. Please start a new thread instead of just replying to someone elses 
and changing the subject - it screws up the threading in decent email 
clients.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux