Listing all files and directories using PHP

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…