Php - List files and directories in a folder, Scandir using php code

List files and directories in a folder


we can list files and directories inside a folder or file path using the function scandir

scandir - List files and directories inside the specified path

Returns an array of files and directories from the directory .
$dir = "./temp";
$files = scandir($dir);
print_r($files);
Example output
Array
(
[0] => .
[1] => ..
[2] => filename1
[3] => filename2
)

The topic on Php - List files and directories in a folder is posted by - Maha

Hope you have enjoyed, Php - List files and directories in a folderThanks for your time

Tech Bluff