Revision: 62012
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 28, 2013 10:20 by ryanve
Initial Code
/** * mtime() Get the modified time of a directory or file. For directories, * it gets the modified time of the most recently modified file. * * @param string $path Full path to directory or file. * @param string $format Date string for use with date() * @return number|string|null */ function mtime ( $path, $format = null ) { $time = null; if ( \is_string($path) && \is_readable($path) ) { if ( \is_dir($path) ) { $path = \rtrim($path, '/'); foreach ( \scandir($path) as $file ) { if ( '.' !== \substr($file, 0, 1) ) { $temp = mtime($path . '/' . $file); $temp > $time and $time = $temp; } } } elseif ( \file_exists($path) ) { $time = \filemtime($path); } } return $time && $format ? \date($format, $time) : $time; }
Initial URL
Initial Description
Get modified time of a directory or file. For directories: it gets the modified time of the most recently modified file.
Initial Title
mtime: modified time
Initial Tags
Initial Language
PHP