PHP 8.5.0 Alpha 4 available for testing

Voting

: min(eight, nine)?
(Example: nine)

The Note You're Voting On

tobias
11 years ago
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);
}

<< Back to user notes page

To Top