Reading a Directory Listing Using opendir() : opendir « File Directory « PHP






Reading a Directory Listing Using opendir()

 
<?php

     $dr = @opendir('/tmp/');
     if(!$dr) {
          echo "Error opening the /tmp/ directory!<BR>";
          exit;
     }

     while(($files[] = readdir($dr)) !== false);

     print_r($files);
?>
  
  








Related examples in the same category

1.Listing directory