Benchmarking using PHP


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. error_reporting(E_ALL | E_STRICT);
  3. define('ITERATIONS', 2000000);
  4. ...
  5. $start = microtime(true);
  6. for ($i=0; $i < ITERATIONS; ++$i) {
  7. // something here we're testing.
  8. }
  9. $stop = microtime(true);
  10. echo "Test name: " . ($stop - $start) . " seconds". PHP_EOL;
  11. ?>

URL: http://www.garfieldtech.com/blog/magic-benchmarks

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.