testing - How can I measure the speed of code written in PHP?

PHOTO EMBED

Fri Jun 18 2021 19:41:25 GMT+0000 (Coordinated Universal Time)

Saved by @mvieira

$startTime = microtime(true);
doTask(); // whatever you want to time
echo "Time:  " . number_format(( microtime(true) - $startTime), 4) . " Seconds\n";

dd( "Time:  " . number_format(( microtime(true) - $startTime), 4) . " Seconds\n");
content_copyCOPY

https://stackoverflow.com/questions/1200214/how-can-i-measure-the-speed-of-code-written-in-php