Return information about a file with stat() function in PHP

Description

The following code shows how to return information about a file with stat() function.

Example


  //from  w w w . j a v a  2s  .  c  o m
<?php
    $stat = stat('test.txt');
    echo 'Acces time: ' .$stat['atime'];
    echo '<br />Modification time: ' .$stat['mtime'];
    echo '<br />Device number: ' .$stat['dev'];
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    File »




Directory
DirectoryIterator
Drive
File
File Permission
File Read Save
FileSystemIterator
Path
Zip