+4 votes
in Programming Languages by (1.9k points)
I want to list all files and directories inside a directory. What PHP function should I use for it?

1 Answer

0 votes
by (15.3k points)

You can use the PHP function scandir() to get all files and directories present inside a directory.

Here is an example

<?php

$dir = "path_to_your_directory/";

print_r(scandir($dir));

?>

...