News Feed
Sections




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

php|architect:
Putting glob() to the test
April 29, 2010 @ 09:27:57

The glob function, the subject of a recent post on NETTUTS.com, is the topic of this new post from Bill Karwin on the php|architect website. He focuses on the efficiency of the function over the convenience it offers.

The glob() function is convenient but the solution using the fewest lines of code isn't always the most efficient - if by efficient you mean fastest. [...] My benchmark results ranged from 12.4 seconds down to 1.2 seconds. That's a pretty wide spread, so it's worth paying attention to performance as well as coding convenience.

He shows the different methods he used to get those results, one that returned an array and filtered directories, another that didn't filter and a third using the GLOB_NOSORT argument. He also compares it with scandir and the opendir/readdir combo.

0 comments voice your opinion now!
glob benchmark file directories performance


blog comments powered by Disqus

Similar Posts

Community News: DreamStats "rootpath" File Inclusion Vulnerability Identified

Lorna Mitchell's Blog: Proof that PHP 5.4 is Twice as Fast as PHP 5.3

PHPClasses.org: Lately in PHP, Episode 26 - Accelerating PHP 5.4 with updated PHP cache extensions

Trevor Lowing\'s Blog: Cluesheet - Tips for PHP Developers

Ben Ramsey's Blog: Lampooning Benchmarks


Community Events

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


unittest php7 api laravel5 podcast video release voicesoftheelephpant laravel language series community interview opinion library list introduction version example framework

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