What are the exceptions to the microtime () function in php?
(PHP 4, PHP 5, PHP 7, PHP 8) Show microtime — Return current Unix timestamp with microseconds Descriptionmicrotime(bool For performance measurements, using hrtime() is recommended. Parametersas_float If used and set to Return Values By default, microtime() returns a string in the form "msec sec", where If ExamplesExample #1 Timing script execution
"Did nothing in $time seconds\n"; Example #2 microtime() and
"Did nothing in $time seconds\n"; See Also
View Discussion Improve Article Save Article View Discussion Improve Article Save Article The microtime() function is an inbuilt function in PHP which is used to return the current Unix timestamp with microseconds. The $get_as_float is sent as a parameter to the microtime() function and it returns the string microsec sec by default. Syntax: microtime( $get_as_float ) Parameters: This function accepts single parameter $get_as_float which is optional. If $get_as_float is set to TRUE then it specify that the function should return a float, instead of a string. Return Value: It returns the string microsec sec by default, where sec is the number of seconds since the Unix Epoch (0:00:00 January 1, 1970, GMT), and microsec is the microseconds part. If the $get_as_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. Exceptions: The microtime() function is only available on operating systems that support the gettimeofday() system call. Below programs illustrate the microtime() function in PHP: Program 1:
Output: The micro time is :0.51423700 1535452933 Program 2:
Output: The micro time is :1535452935.2589 Related Articles:
Reference: http://php.net/manual/en/function.microtime.php What is Microtime function in PHP?PHP microtime() function returns the current Unix timestamp. By default this returns a string value in the form msec sec. If you pass the boolean value true as a parameter to this method, it returns the current time in seconds since the Unix epoch accurate to the nearest microsecond.
Is microtime in seconds?By default, microtime() returns a string in the form "msec sec", where sec is the number of seconds since the Unix epoch (0:00:00 January 1,1970 GMT), and msec measures microseconds that have elapsed since sec and is also expressed in seconds as a decimal fraction.
What is microtime?Definition of microtime
: a very short interval of time (as 0.01 millionth of a second) microtime photography.
What is PHP time function?The time() function returns the current time in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
|