scandirList files and directories inside the specified path Description
array scandir
( string
$directory
[, int $sorting_order = SCANDIR_SORT_ASCENDING
[, resource $context
]] )
Returns an array of files and directories from the
Parameters
Return Values
Returns an array of filenames on success, or Changelog
Examples
Example #1 A simple scandir example
<?php The above example will output something similar to: Array ( [0] => . [1] => .. [2] => bar.php [3] => foo.txt [4] => somedir ) Array ( [0] => somedir [1] => foo.txt [2] => bar.php [3] => .. [4] => . )
Example #2 PHP 4 alternatives to scandir
<?php The above example will output something similar to: Array ( [0] => . [1] => .. [2] => bar.php [3] => foo.txt [4] => somedir ) Array ( [0] => somedir [1] => foo.txt [2] => bar.php [3] => .. [4] => . ) NotesTip
A URL can be used as a filename with this function if the fopen wrappers have been enabled. See fopen for more details on how to specify the filename. See the Supported Protocols and Wrappers for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide. See Also
|