Updates the access and modification times of the specified file.
| <?php filename = “test.txt”; if (touch($filename)) { echo $filename . ” modification time has been changed to present time”; } else { echo “Sorry, could not change modification time of “ . $filename; } ?> |
The touch() function updates the access and modification times of the specified file.
Note: If the file does not exist, it will be created.
| touch(filename, time, atime) |
|
Parameter |
Description |
|
filename |
Required. Specifies the file to update. |
|
time |
Optional. Specifies the time to set for the file; the current system time is used by default. |
|
atime |
Optional. Specifies the access time; by default, it uses the current system time if no parameter is set, or the same value as the |
|
Return Value: |
Returns TRUE on success, FALSE on failure. |
|
PHP Version: |
4.0+ |
|
PHP Changelog: |
PHP 5.3 – |