Get a list of files or directories using PHP glob()

The PHP glob() function returns an array of filenames or directories matching a specified pattern.

This function returns an array of files or directories or FALSE on failure.

Syntax: 

glob(pattern,flags)

Example:

The output of the code above could be:

 

Author: Richard Soares

I’m a freelance software developer with more than 20 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork.