franzwarning Posted March 23, 2011 Share Posted March 23, 2011 Here is my current code to display files from the end to beginning : <?php function func() { $date = date("Y-m-d"); $picarray = array(); $userarray = array(); $handle = opendir ('pqimages/'.$date.'/'); while (false !==($file = readdir($handle))) { if($file != "." && $file != "..") { $picarray[] = "http://blah.com/pqimages/".$date."/".$file.""; $userarray[]= "pqimages/".$date."/".$file.""; } } sort($picarray); sort($userarray); closedir($handle); $json_array = json_encode($picarray); echo $json_array; } func(); ?> How could I change this from end to beginning for ($picarray)? Cheers, George Quote Link to comment Share on other sites More sharing options...
DavidAM Posted March 23, 2011 Share Posted March 23, 2011 Try rsort() instead of sort()? Quote Link to comment Share on other sites More sharing options...
Maq Posted March 23, 2011 Share Posted March 23, 2011 Next time you post in the wrong section just click on "Report to Moderator" and one of us will move your thread to the appropriate section. Do not double post. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted March 23, 2011 Share Posted March 23, 2011 array_reverse() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.