PHP stat() Function

P
PHP symlink() Function
PHP set_file_buffer() Function

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)
ParameterDescription
filenameRequired. Specifies the path to the file
PHP stat() method

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"];
?>
PHP symlink() Function
PHP set_file_buffer() Function

Add comment

Tutor Network

Share this

Learn PHP from A to Z