Revision: 22012
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 28, 2009 17:02 by chrisaiv
Initial Code
$dir = "."; if( is_dir( $dir ) ){ if( $dir_handle = opendir( $dir ) ){ while( $filename = readdir( $dir_handle ) ){ echo "filename: {$filename}<br />" ; } //rewinddir($dir_handle) to start over closedir( $dir_handle ); } } echo "<hr />"; if( is_dir( $dir ) ){ $dir_array = scandir( $dir ); foreach( $dir_array as $file ){ if( stripos( $file, '.' ) > 0){ echo "filename: {$file}<br />"; } } }
Initial URL
Initial Description
See the contents within a directory and print them out.
Initial Title
PHP: List out items in a directory
Initial Tags
php
Initial Language
PHP