php directory to array code example
Example 1: list all files in directory php
$path = './';
$files = scandir($path);
$files = array_diff(scandir($path), array('.', '..'));
foreach($files as $file){
echo "<a href='$file'>$file</a>";
}
Example 2: php list directories
$dir = '.';
$directories = glob($dir . '/*', GLOB_ONLYDIR);