note 99491 added to function.filemtime
| From: | michael dot damato dot NOSPAM at gmail dot com | Date: | Thu, 19 Aug 2010 21:37:11 +0000 |
| Subject: | note 99491 added to function.filemtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171866@lists.php.net to get a copy of this message | ||
Here is an improved, much smaller version of a function that will return the most recent last
modified date of a folder's contents
<?php
function lastModifiedDate($folder, $recursive=true)
{
$filesAry = glob("{$folder}/*");
foreach($filesAry as $file)
{
$lastMod = max(filemtime($file),
(is_dir($file)&&$recursive)?lastModifiedDate($file):0);
}
return $lastMod;
}
?>
----
Server IP: 92.48.74.199
Probable Submitter: 160.109.98.44
----
Manual Page -- http://www.php.net/manual/en/function.filemtime.php
Edit -- https://master.php.net/note/edit/99491
Del: integrated -- https://master.php.net/note/delete/99491/integrated
Del: useless -- https://master.php.net/note/delete/99491/useless
Del: bad code -- https://master.php.net/note/delete/99491/bad+code
Del: spam -- https://master.php.net/note/delete/99491/spam
Del: non-english -- https://master.php.net/note/delete/99491/non-english
Del: in docs -- https://master.php.net/note/delete/99491/in+docs
Del: other reasons-- https://master.php.net/note/delete/99491
Reject -- https://master.php.net/note/reject/99491
Search -- https://master.php.net/manage/user-notes.php