PHP stat() Function
❮ PHP Filesystem ReferenceExample
Get information 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"];
?>
Run Example »
Definition and Usage
The stat() function returns information about a file.
Note: The results from this function will differ from server to server. The array may contain the number index, the name index, or both.
Note: The result of this function is cached. Use clearstatcache() to clear the cache.
Syntax
stat(filename)
Parameter Values
Parameter | Description |
---|---|
filename | Required. Specifies the path to the file |
Technical Details
Return Value: |
An array with the following elements:
It returns an E_WARNING on failure |
---|---|
PHP Version: | 4.0+ |
❮ PHP Filesystem Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.