gettimeofday

Get current time

Syntax

gettimeofday(bool $as_float = false): array|float

Parameters

as_float

When set to TRUE, a float instead of an array is returned.

Return

By default an array is returned. If as_float is set, then a float is returned.

Key Description
"sec" seconds since the Unix Epoch
"usec" microseconds
"minuteswest" minutes west of Greenwich
"dsttime" type of dst correction

Examples

void

<?

$return = gettimeofday();

print_r($return);

?>
Array
(
    [sec] => 1638812204
    [usec] => 783724
    [minuteswest] => 0
    [dsttime] => 0
)

as_float

<?

$as_float = true;

$return = gettimeofday($as_float);

echo $return;

?>
1638812204.7947

PHP

Home Menu