|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-03-05 11:43 UTC] sas at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 13 21:00:01 2026 UTC |
# PHP4B3. Haven't tried PHP3. $ar = array( "653434" => "Foo", "6452323" => "Bar", "9873" => "foobar" ); while( list( $k, $v ) = each( $ar ) ) { echo "$k --- $v<BR>\n"; } reset( $ar ); sort( $ar ); while( list( $k, $v ) = each( $ar ) ) { echo "$k --- $v<BR>\n"; } # The first one prints okay. # In the second one, the keys are reset to 0-2. # ksort does not do this (obviously), but there # is no rksort(), and I need to sort a list of files by # modification time (newest first). Suggestion? # I currently hold the files as an array, with the # filemtime() as the key. Also tried the names as the key, # and the filemtime() as the value, but then I lose the # key during a sort() or rsort(), anyway.