getlastmod()

getlastmod() — Gets time of last page modification.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

Gets the time of the last modification of the main script of execution.

Signature

getlastmod(): int|false

Parameters

This function takes no parameters.

Return value

Returns the time of the last modification of the current page. The value returned is a Unix timestamp, suitable for feeding to date(). Returns false on error.

Example

A runnable snippet:

// outputs e.g. 'Last modified: March 04 1998 20:43:59.' echo "Last modified: " . date ("F d Y H:i:s.", getlastmod());

See also

date(), getmyuid(), getmygid(), get_current_user(), getmyinode(), getmypid(), filemtime()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page getlastmod() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.