PDA

View Full Version : filemdate, intercept warning



stevenvh
08-23-2009, 10:22 AM
Hi,
I want to place the file's creation date at the bottom of my pages.


$filedate = filemtime($thisfile);
if ($filedate > 0) {
print "Last modified: " . date("Y-m-d", $filedate);
}


For some reason for some files I get a "stat failed" warning. I thought I could test for the returned filedate, and only print when valid, but then the warning still appears. How can I get rid of it?
TIA
Steven

stevenvh
08-23-2009, 11:39 AM
OK, I found the answer, but I'll post it here in case somebody else has the same question:

You can suppress error and warning messages by preceding the function name with an "@"-sign: filemtime becomes @filemtime.