Php microseconds

I use echo date('H:i:s')." this step time\n";
 to find out how long it takes for each function to execute.

How to find out the time in microseconds?

+3
source share
3 answers

Just add the PHP microtime () function , which can be used as follows:

$time_start = microtime(true);

//do stuff here

$time_end = microtime(true);
$time = $time_end - $time_start;

echo "It took $time seconds\n";
+9
source
u Microseconds (added in PHP 5.2.2)

Take a look at http://no.php.net/manual/en/function.date.php for more information.

+4
source

Use the 'u' token in millisecond format.

+1
source

Source: https://habr.com/ru/post/1706826/


All Articles