List all files in one directory PHP [duplicate]

You are looking for the command scandir.

$path="/tmp";
$files = scandir($path);

Following code will remove . and .. from the returned array from scandir:

$files = array_diff(scandir($path), array('.', '..'));

Leave a Comment