Last Updated: February 25, 2016
· nmalcolm

The PHP Benchmark - Live PHP Benchmark

From phpbench.com — PHPBench.com was constructed as a way to open people's eyes to the fact that not every PHP code snippet will run at the same speed. You may be surprised at the results that this page generates, but that is ok. This page was also created so that you would be able to find discovery in these statistics and then maybe re-run these tests in your own server environment to play around with this idea yourself, by using the code examples (these code examples are automatically generated and as the code in my .php files change, so do they).


2 Responses
Add your response


Hi Nathan,

The issue I have found with phpbench is that I did a very simular test with the "foreach vs for vs while" loops and my tests differed from their results.

My foreach loop was faster than both for and while, now this came to me as a big surprise as the way that foreach works, so I got another couple of developers to check over it and they were as surprised as I was, but the results were conclusive throughout all of our tests.

So just bare in mind to not take these tests as 100% guaranteed and do your own research to ensure that they are correct.

over 1 year ago ·

@darkmantiscs I completely agree. The results can vary from environment to environment but when you're shipping code, for say, an open source project, these can come in handy as it'll be run on many different versions of PHP, OS, etc... so it can give you a rough estimate. From there you can make an informed choice of which functions and constructs to use.

over 1 year ago ·