Have you ever wondered how without an index file all files and directories are appearing in your web root? Or in any directory. Well it is just a CGI script doing that on the server most of the cases. With PHP, you can simply do that. There are lots of way of doing so but today I will be showing the most simple way using a built-in function named glob().
The glob() function searches for all the pathnames matching
patternaccording to the rules used by the libc glob() function, which is similar to the rules used by common shells. Manual to read: http://php.net/manual/en/function.glob.php