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 microsecond as float.
$start = microtime(true); sleep(5); # Sleep 5 seconds $dur = (microtime(true) - $start) * 1000; print "sleep took $dur milliseconds\n";