array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'function.gettimeofday.php', 1 => 'gettimeofday', ), 'up' => array ( 0 => 'ref.datetime.php', 1 => 'Date/Time Functions', ), 'prev' => array ( 0 => 'function.getdate.php', 1 => 'getdate', ), 'next' => array ( 0 => 'function.gmdate.php', 1 => 'gmdate', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/datetime/functions/gettimeofday.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
gettimeofday — Get current time
This is an interface to gettimeofday(2). It returns an associative array containing the data returned from the system call.
By default an array is returned. If as_float
is set, then a float is returned.
Array keys:
Example #1 gettimeofday() example
<?php
print_r(gettimeofday());
echo gettimeofday(true);
?>
The above example will output something similar to:
Array ( [sec] => 1073504408 [usec] => 238215 [minuteswest] => 0 [dsttime] => 1 ) 1073504408.23910