News Feed
Jobs Feed
Sections




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

John Walsh's Blog:
PHP Benchmark - For vs While
March 26, 2007 @ 15:19:23

John Walsh filled us in on a new set of benchmarks he worked up comparing two of the standard looping structures in PHP - for versus while.

People always ask me what statement is faster, so I've gone ahead and created a benchmark test using Apache's AB Benchmarking tool. There's no reason not to use For either, you can use it with any while statement but While in some cases mean's less lines, but i prefer speed than less lines of code.

He created some simple scripts to perform the tests and ran them through the AB benchmarker to come up with his results - with while just barely edging out the for loop by one millisecond.

1 comment voice your opinion now!
benchmark loop forloop whileloop apache tool millisecond benchmark loop forloop whileloop apache tool millisecond


blog comments powered by Disqus

Similar Posts

Brandon Savage's Blog: Picking The Right Tools For The Job

Hasin Hayder's Blog: Counting occurrence of a word in a String - Benchmarking of PHP functions

David Sklar\'s Blog: I lxr.php.net

Richard Davey's Blog: WAMP Guide updated for PHP 5.2.3

php|architect: Are We Losing LAMP?


Community Events











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


composer database symfony2 performance opinion install podcast release series facebook unittest language package introduction hack hhvm framework security application component

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