PHP Microtime () function

PHP

Syntax:
microtime ($get_as_float)
Parameters:This function takes one parameter $get_as_float , which is optional. If $get_as_float is TRUE, this indicates that the function should return a floating point number instead of a string.Return value:returns a string by default microsecond sec , where sec - is the number of seconds since the beginning of the Unix epoch (0:00:00 January 1, 1970 GMT), and the microsecond - fraction of microseconds. If $get_as_float is TRUE, it returns a floating point value representing the current time in seconds since the beginning of the Unix epoch, down to the nearest microsecond.Exceptions:microtime() is only available on operating systems that support the gettimeofday() system call.The following programs illustrate the microtime() function in PHP:Program 1:  
// Display micro time as a string echo ( "The micro time is:" ); echo (microtime()); ?>
Exit:
The micro time is: 0.51423700 1535452933
Program 2:  
// Display micro time as floating point echo ( "The micro time is:" ); echo (microtime (true)); ?>
Exit:
The micro time is: 1535452935.2589
Related Articles:
  • PHP | Gmdate() function
  • PHP | time function()
Link: http://php.net/manual/en/function.microtime.php



Get Solution for free from DataCamp guru