Answers for "get time in execution time function php"

PHP
4

php time script

//place this before any script you want to calculate time
$time_start = microtime(true); 

//sample script
for($i=0; $i<1000; $i++){
 //do anything
}

$time_end = microtime(true);
$execution_time = ($time_end - $time_start);
echo '<b>Total Execution Time:</b> '.($execution_time*1000).'Milliseconds';
Posted by: Guest on April-28-2020
0

php set time counters inside code meassure

<?php
//No need for microtime at the start of script.

// Use this at the end of your script, or around in the 
// code where you need to take meassures.
$time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"];

echo "Did stuff in $time seconds\n";
?>
Posted by: Guest on December-27-2020

Browse Popular Code Answers by Language