Home >>PHP Date Time Functions >PHP microtime() Function

PHP microtime() Function

PHP microtime() Function

PHP microtime() function is used to return the current Unix timestamp with microseconds. It accepts only a single parameter which is optional. It returns the string microsec sec as output.

Syntax:

  microtime(return_float);

Parameter Values

Parameter Description
return_float This is an optional parameter. When it is set to TRUE it specifies that the function should return a float instead of a string.

Here is an example of microtime() function in PHP:

<html>
<body>
<?php
echo microtime();
?>
</body>
</html>
Output:
0.23379200 1580704565

Example 2:

<html>
<body>
<?php
echo microtime()."<br>";
echo microtime(true);
?>
</body>
</html>
Output:
0.20528900 1580704844
1580704844.2053

No Sidebar ads