PHP time() Function: Explained with Examples

The time() function is used to retrieve the current Unix timestamp.

A Unix timestamp is a representation of the number of seconds that have passed since 00:00:00 GMT on January 1, 1970. It can be used for calculating time intervals, comparing dates and times, and other operations.

Grammar:

time()

Return value: The function returns the current Unix timestamp as an integer.

我的课程作业需要明天交。-> My coursework assignment is due tomorrow.

<?php
    echo time();
?>

Example output:

1602173402
bannerAds