The gettimeofday() function returns an array that contains current time information.
Syntax
gettimeofday(return_float)
Parameters
return_float − When set to TRUE, a float instead of an array is returned.
Return
The gettimeofday() function returns an associative array by default. The following are the returned array keys
[sec] − seconds since the Unix Epoch
[usec] − microseconds
[minuteswest] − minutes west of Greenwich
[dsttime] − type of dst correction
Example
The following is an example −
<?php print_r(gettimeofday()); ?>
Output
Array ( [sec] => 1539234547 [usec] => 322766 [minuteswest] => 0 [dsttime] => 0 )
Example
The following is an example −
<?php echo gettimeofday(true); ?>
Output
1539172203.5542
Example
The following is an example
<?php $res = gettimeofday(); echo "$res[sec].$res[usec]"; ?>
Output
1539172298.346375