time() gives the timestamp of Greenwich Mean Time (GMT) which is defined as the official time for the whole earth. You get the local time by adding the time zone offset to this timestamp.
(PHP 4, PHP 5, PHP 7, PHP 8)
time — Retorna o timestamp Unix atual
Retorna a hora atual medida no número de segundos desde a Era Unix (January 1 1970 00:00:00 GMT).
Exemplo #1 time() example
<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
// 7 days; 24 hours; 60 mins; 60secs
echo 'Now: '. date('Y-m-d') ."\n";
echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";
// or using strtotime():
echo 'Next Week: '. date('Y-m-d', strtotime('+1 week')) ."\n";
?>
O exemplo acima irá imprimir algo similar à:
Now: 2005-03-30 Next Week: 2005-04-06 Next Week: 2005-04-06
O timestamp do início da requisição está disponível na variável $_SERVER['REQUEST_TIME'] desde o PHP 5.1.
time() gives the timestamp of Greenwich Mean Time (GMT) which is defined as the official time for the whole earth. You get the local time by adding the time zone offset to this timestamp.