In this article, you will learn how to get the information about the file in PHP. The stat() function in PHP returns information about a file. The information contains number index and the name index. It may contains both or any of these depending on the server.
what is the syntax of the STAT function in php?
stat(filename)
Parameter | Description |
---|---|
filename | Required. Specifies the path to the file |
examples of the STAT function
Example 1. In this example, we 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"];
?>