Thursday, June 14, 2012

How to Find Most Recently Updated File in PHP

How to Find  Most Recently Updated  File  in PHP

$path = "./";  // put your directory path here 
foreach (glob($path) as $filename) 
if (filemtime($filename) >= $recentDate)
 $recentDate = filemtime($filename); 
 $recentDate = date(" F d, Y",$recentDate); 

echo
"Most Recently Updated File".$recentDate;?>

No comments: