Share on Google+Share on Google+


This is the example of PHP microtime function used for returning current Unix timestamp.

PHP microtime() Function

microtime() returns the current Unix timestamp with microseconds. microtime function is only available on operating systems that support the gettimeofday() system call. This function returns the string "microsec sec", where sec is the number of seconds since the Unix Epoch (0:00:00 January 1, 1970 GMT), and microsec is the microseconds part. Notice that both parts are returned in units of seconds.

Syntax of microtime() Function PHP


Parameter & Description of microtime() Function PHP

get_as_float - this is an optional parameter that is used for returning the result in float while the default result is in string. 

Example on microtime() Function PHP


The output of the code above could be:
0.45863896 1257598635


Posted on: August 28, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null