Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

microtime()

Example

Returns the current Unix timestamp with microseconds.

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

Definition and Usage

The microtime() function provides the current Unix timestamp with microseconds.

Syntax

microtime(return_float);

Parameter Values

 

Parameter

Description

return_float

Optional. When set to TRUE, it specifies that the function should return a float instead of a string. The default is FALSE.

Technical Details

Return Value:

By default, returns a string in the format “microsec sec,” where sec represents the number of seconds since the Unix Epoch (00:00:00 January 1, 1970 GMT) and microsec represents the microseconds. If the return_float parameter is set to TRUE, it returns a float representing the current time in seconds since the Unix Epoch, accurate to the nearest microsecond.

PHP Version:

4+

PHP Changelog:

PHP 5.0: Introduced the return_float parameter.