Get inode change time of the current DirectoryIterator item in PHP

Description

The following code shows how to get inode change time of the current DirectoryIterator item.

Example


//from   w w  w.j a  v a2 s.  c om
//This example displays the file name and last change 
//time of the files in the directory containing the script.
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
foreach ($iterator as $fileinfo) {
    if ($fileinfo->isFile()) {
        echo $fileinfo->getFilename() . " changed at " . $fileinfo->getCTime() . "\n";
    }
}
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    File »




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