CKTIS / PHP
microtime()
Read wall-clock Unix time with a microsecond component.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
microtime(bool $as_float = false): string|floatRead wall-clock Unix time with a microsecond component. By default the string contains the fractional part, a space, and whole seconds. Passing true gives seconds as a float. A system clock adjustment can affect elapsed times measured this way.
Signature
microtime(bool $as_float = false): string|float
Example output
[true,true,true]
Examples
<?php
[$fraction,$seconds]=explode(" ", microtime()); $now=microtime(true);
echo json_encode([is_numeric($fraction),ctype_digit($seconds),is_float($now)]);
Result
[true,true,true]