PHP hrtime() Function
The PHP hrtime() function returns the system's high resolution time, counted from an arbitrary point in time. The delivered timestamp is monotonic and can not be adjusted.
Syntax
hrtime(as_number)
Parameters
as_number |
Optional. If set to true the high resolution time is returned as a number. Default is false which means it is returned as an array. |
Return Value
Returns an array of integers in the form [seconds, nanoseconds], if the parameter as_number is false. Otherwise the nanoseconds are returned as int (64bit platforms) or float (32bit platforms). Returns false on failure.
Example: hrtime() example
The example below shows the usage of hrtime() function.
<?php //getting system's high resolution //time as int echo hrtime(true), PHP_EOL; //getting system's high resolution //time as an array print_r(hrtime()); ?>
The output of the above code will be similar to:
1569417661108531 Array ( [0] => 1569417 [1] => 661154889 )
❮ PHP Miscellaneous Reference