Retrieve details about a file.
<?php $stat = stat(“test.txt”); echo “Access time: “ .$stat[“atime”]; echo “<br>Modification time: “ .$stat[“mtime”]; echo “<br>Device number: “ .$stat[“dev”]; ?> |
The stat() function provides information about a file.
Note: The output may vary depending on the server, with the array possibly including the index for the number, the name, or both.
Note: The results are cached. Use clearstatcache() to clear the cache.
stat(filename) |
Parameter |
Description |
filename |
Required. Specifies the path to the file. |
Return Value: |
Returns an array with the following elements:
Returns an E_WARNING on failure. |
PHP Version: |
4.0+ |