Php glob function

Maybe it’s common use and everybody but me already knew it, but after ten years of php development, I’ve just find a very useful php function: Glob.

Glob function can be used to return an array of files from a given path, where file names matches a pattern.

Per example, if you need to find all files whose name begins with form- you just have to use:

Or inside a loop to do something on each of these file:

Proof that we learn everyday!

Published by

Constantin Guay

Currently Data Project Manager and Scrum Evangelist at NetMediaEurope, european leader in IT B2B news site (more than 12 million unique visitors per month). Passionate by user experience and data science. Scrum evangelist

Leave a Reply

Your email address will not be published. Required fields are marked *