$start = microtime(true); sleep(5); # Sleep 5 seconds $dur = (microtime(true) - $start) * 1000; print "sleep took $dur milliseconds\n";
Programming Tips - PHP: time a function in milliseconds
Date: 2020nov14
Language: php
Q. PHP: time a function in milliseconds
A. Use microtime(true) which gives the time in microseconds as float.