News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPCodeBase.com:
PHP Magic Function glob()
April 01, 2011 @ 08:21:20

On PHPCodeBase.com there's a recent post looking at a handy file system function that you can use to search directories simpler than a usual opendir/readdir method - glob.

Are you guys still using opendir() function to read the the files from the folder in PHP? Luckily PHP have the glob() function which perform this task very faster and smarter.

He compares an example of the opendir/readdir method to a few line replacement with glob, both searching the same directory for files. He looks at the arguments you can pass into glob - the path to search and a flag that adds special handling to the method (like turning off sorting, modifying the regular expression handling and stopping on errors).

2 comments voice your opinion now!
function glob opendir readdir regularexpression search


blog comments powered by Disqus

Similar Posts

Rob Allen's Blog: Luke - Lucene Index Toolbox

SitePoint PHP Blog: Using Solarium with SOLR for Search Solarium and GUI

Stefan Mischook's Blog: Creating Custom PHP Functions Video Tutorial - Part 3

Stoimen Popov's Blog: preg_match Give Names to the Matches

Sameer Borate's Blog: Web scraping tutorial


Community Events





Don't see your event here?
Let us know!


list podcast testing refactor interview series opinion code developer wordpress threedevsandamaybe framework configure unittest community laravel release introduction language install

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework