➤ Clock time can get using microtime() function. First use it before starts the script and then at the end of the script. Then using formula (End_time – Start_time). ➤ The microtime() function returns the current Unix timestamp with microseconds. By default, the microtime() function returns the time as a string, but if it is set to TRUE, then the function returns the time as a float. So the default is FALSE. For instance:
// Starting clock time in seconds
$start_time = microtime(true);
$result = 0;
for( $i = 0; $i <=1000000; $i++ )
{
	$result += $i;
} 
// End clock time in seconds
$end_time = microtime(true);
  
// Calculate script execution time
$execution_time = ($end_time - $start_time);
echo " Execution time of script = ".$execution_time." sec";
by Levani Makhareishvili
2 years ago
PHP
Function
1
Pro tip: use ```triple backticks around text``` to write in code fences