PHP touch() Function

Sets the access and modification time of the specified file

Definition and Usage

The touch() function sets the access and modification time of the specified file.

Note: If the specified file does not exist, it will be created.

Syntax

touch(filename, time, atime)

Parameter Values

Parameter Description
filename Required. Specifies the file to touch
time Optional. Sets the touch time. The current system time is set by default
atime Optional. Sets the access time. Default is the current system time if no parameters are set, or the same as the time parameter if that parameter is set

Technical Details

Return Value: TRUE on success, FALSE on failure
PHP Version: 4.0+
PHP Changelog: PHP 5.3 -

❮ PHP Filesystem Reference