scandir

it lists files and directories of a given path.

Example

<?php
echo “<pre>”;
$dir    = ‘/var/www/test/’;
$files1 = scandir($dir);
print_r($files1);
?>

Output

Array
(
[0] => .
[1] => ..
[2] => index.php
[3] => enc.php
)