Jump to content

sorting files in reverse


ianco

Recommended Posts

Hi all

 

I have some code that displays the contents of each file from a given folder. The thing is it displays files alphabetically. I want to do the opposite (z to a). I've played around with the asort() function and can't seem to get it right.

 

Doe's anyone have a solution?

 

Thanks

Ian

 

<?php
if ($handle = opendir('./files/')) {
   while (false !== ($file = readdir($handle)))
      {
          if ($file != "." && $file != "..")
  {
	include("./files/" . $file);

	echo "<br>";
          }
       }
  closedir($handle);
  }

?>

Link to comment
https://forums.phpfreaks.com/topic/191606-sorting-files-in-reverse/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.