w3resource
PHP Tutorial

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



New Content: Composer: Dependency manager for PHP, R Programming