Skip to content

Instantly share code, notes, and snippets.

@yussan
Last active October 6, 2021 13:20
Show Gist options
  • Save yussan/7b7ded7e3c12bb82d44fbd2f54ad9e39 to your computer and use it in GitHub Desktop.
Save yussan/7b7ded7e3c12bb82d44fbd2f54ad9e39 to your computer and use it in GitHub Desktop.
Generate Total Execution Time on PHP in miliseconds
<?php
//place this before any script you want to calculate time
$time_start = microtime(true);
// your script code goes here
// do something
Put this at the end of your php file:
// Display Script End time
$time_end = microtime(true);
//total execution time in miliseconds
$execution_time = $time_end - $time_start;
//execution time of the script
echo '<b>Total Execution Time:</b> '.$execution_time.' Miliseconds';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment