Skip to content

Instantly share code, notes, and snippets.

@ufhy
Created September 18, 2018 00:33
Show Gist options
  • Save ufhy/f12cfcf34d05cb6894a0f017d502d7db to your computer and use it in GitHub Desktop.
Save ufhy/f12cfcf34d05cb6894a0f017d502d7db to your computer and use it in GitHub Desktop.
Snippet Code To Benchmark Your PHP Script
<?php
$start = microtime(true);
// Script you want to test here
usleep(200000); // sleep 2 seconds
$end = microtime(true);
$r = round($end - $start,4);
echo '<strong>Execution Time</strong>: '.$r.' seconds<br />';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment