For this we will use microtime() function — Return current Unix timestamp with microseconds.
//Start calculating the time $time_start = microtime(true); for($i=0; $i< 1000; $i++){ echo $i." "; } sleep(1); // Finish time calculation $time_end = microtime(true); $time = $time_end - $time_start; // Display script time echo "</br>The script ran into $time microseconds"; //Result: The script ran into 1.0140018463135 microseconds
Hello there!
I hope you find this post useful!I'm Mihai, a programmer and online marketing specialist, very passionate about everything that means online marketing, focused on eCommerce.
If you have a collaboration proposal or need helps with your projects feel free to contact me. I will always be glad to help you!