The mentioned example:
$filename = 'somefile.txt';
if (file_exists($filename)) {
echo "$filename wurde zuletzt modifiziert:: " . date ("F d Y H:i:s.", filemtime($filename));
}
works, however is not ideal from a performance point of view of serving static files through PHP, since it basically needs two perform two file system operations (file_exists and filemtime). A more effective way would be to only use filemtime and save the overhead of file_exists using:
$filename = 'somefile.txt';
$fmtime = filemtime($filename);
if (!$fmtime) {
echo "$filename wurde zuletzt modifiziert:: " . date ("F d Y H:i:s.", $fmtime);
}