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

1 Answer

+2 votes
by (63.4k points)
selected by
Best answer

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

Here is an example


$dir = "path_to_your_directory/";