w3resource

PHP: microtime() function

Description

The microtime() function creates current Unix timestamp with microseconds values.

Version:

(PHP 4 and above)

Syntax:

microtime(get_as_float) 

Parameter:

Name Description Required /
Optional
Type
get_as_float When it set to true then a float (in seconds) is returned instead of a string. Optional Boolean

Return value:

Unix timestamp

Value Type: Mixed*.

*Mixed : Mixed indicates multiple (but not necessarily all) types.

Example:

<?php
echo(microtime());
?>

Output:

0.01583100 1295421766

Note: Since the current time is not static, therefore the output may vary.

View the example in the browser

See also

PHP Function Reference

Previous: localtime
Next: mktime



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/php/function-reference/microtime.php