microtime function
<?php
function doSomething(int $seconds): void
{
sleep($seconds);
}
$startTime = microtime(true);
doSomething(3);
$endTime = microtime(true);
$executionTime = $endTime - $startTime;
echo sprintf('%.8f sec', $executionTime);
Leave a Comment
Cancel reply