PHP | DirectoryIterator getCTime() Function Last Updated : 07 Mar, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The DirectoryIterator::getCTime() function is an inbuilt function in PHP which is used to get the inode change time of the current DirectoryIterator item. Syntax: int DirectoryIterator::getCTime( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the last change time of the file in Unix timestamp format. Below programs illustrate the DirectoryIterator::getCTime() function in PHP: Program 1: php <?php // Create a directory Iterator $directory = new DirectoryIterator(dirname(__FILE__)); // Loop runs while directory is valid while ($directory->valid()) { // Check if the element is directory if ($directory->isDir()) { // Store the current element $file = $directory->current(); // Display the file name and // inode change time echo $file->getFilename() . " | CTime: " . $directory->getCTime() . "<br>"; } // Move to the next element $directory->next(); } ?> Output: . | CTime: 1574350718 .. | CTime: 1574350715 dashboard | CTime: 1574350718 img | CTime: 1574350718 webalizer | CTime: 1574350718 xampp | CTime: 1574350718 Program 2: php <?php // Create a directory Iterator $directory = new DirectoryIterator(dirname(__FILE__)); // Loop runs for each element of directory foreach($directory as $dir) { // Store the current element of directory $file = $directory->current(); // Display the key, filename and // its inode change time echo $dir->key() . " => " . $file->getFilename() . " | CTime: " . $dir->getCTime() . "<br>"; } ?> Output: 0 => . | CTime: 1574350718 1 => .. | CTime: 1574350715 2 => applications.html | CTime: 1574350724 3 => bitnami.css | CTime: 1574350724 4 => dashboard | CTime: 1574350718 5 => favicon.ico | CTime: 1574350724 6 => geeks.PNG | CTime: 1574478578 7 => gfg.php | CTime: 1574351394 8 => img | CTime: 1574350718 9 => index.php | CTime: 1574350723 10 => webalizer | CTime: 1574350718 11 => xampp | CTime: 1574350718 Note: The output of this function depends on the content of server folder. Comment More infoAdvertise with us Next Article PHP | DirectoryIterator getType() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Iterators Similar Reads PHP | DirectoryIterator getMTime() Function The DirectoryIterator::getMTime() function is an inbuilt function in PHP which is used to returns the last modification time of the current DirectoryIterator item. Syntax: int DirectoryIterator::getMTime( void ) Parameters: This function does not accept any parameters. Return Value: This function re 2 min read PHP | DirectoryIterator getATime() Function The DirectoryIterator::getATime() function is an inbuilt function in PHP which is used to get the last access time of the current DirectoryIterator item. Syntax: int DirectoryIterator::getATime( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the 2 min read PHP | DirectoryIterator getType() Function The DirectoryIterator::getType() function is an inbuilt function in PHP which is used to check the type of the current DirectoryIterator item. Syntax: string DirectoryIterator::getType( void ) Parameters: This function does not accept any parameters. Return Value: This function returns a string whic 2 min read PHP | DirectoryIterator getSize() Function The DirectoryIterator::getSize() function is an inbuilt function in PHP which is used to returns the size of the current DirectoryIterator item. Syntax: int DirectoryIterator::getSize( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the size of th 2 min read PHP | DirectoryIterator getFilename() Function The DirectoryIterator::getFilename() function is an inbuilt function in PHP which is used to return file name of current DirectoryIterator item. Syntax: string DirectoryIterator::getFilename( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the fil 1 min read PHP | DirectoryIterator getPath() Function The DirectoryIterator::getPath() function is an inbuilt function in PHP which is used to get the path of current Iterator item without filename. Syntax: string DirectoryIterator::getPath( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the file pa 2 min read Like