Listing files with PHP

Views: 726
Reading Time: 2 minutes

Staff,
Good evening.

I will show you how to list files from a directory in PHP using 2 functions and then natively. I will create a class with static methods so as not to instantiate the object.

How to use:

The above example will print something similar to:

Now let's see using the native function globe from PHP:

The above example will print something similar to:
size of funclist.txt 44686
funcsummary.txt size 267625
quickref.txt size 137820

For more information about the glob function, go to http://www.php.net/manual/pt_BR/function.glob.php

That's it!!