Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

filemtime()

Example

Find out the most recent time the file was changed.

<?php
echo filemtime(“webdictionary.txt”);
echo “<br>”;
echo “Content last changed: “.date(“F d Y H:i:s.”, filemtime(“webdictionary.txt”));
?>

Definition and Usage

The filemtime() function tells us when the file was last changed. This function saves the result so it can be used again later.

Use clearstatcache() to remove the saved result.

Syntax

filemtime(filename)

Parameter Values

 

Parameter

Description

filename

Essential. gives the location of the file to be checked.

Technical Details

Return Value:

The last time the content of the file was changed (as a Unix timestamp, failing with FALSE).

PHP Version:

4.0+