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.

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

Examples

1 · void

<?

$return = gettimeofday();

print_r($return);

?>
Array
(
    [sec] => 1685708156
    [usec] => 564135
    [minuteswest] => 0
    [dsttime] => 0
)

2 · as_float

<?

$as_float = true;

$return = gettimeofday($as_float);

echo $return;

?>
1685708156.6305
HomeMenu