note 113262 added to function.filemtime
| From: | tobias | Date: | Wed, 18 Sep 2013 20:02:19 +0000 |
| Subject: | note 113262 added to function.filemtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-196304@lists.php.net to get a copy of this message | ||
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);
}
----
Server IP: 69.147.83.199
Probable Submitter: 78.53.195.32
----
Manual Page -- http://php.net/manual/en/function.filemtime.php
Edit -- https://master.php.net/note/edit/113262
Del: integrated -- https://master.php.net/note/delete/113262/integrated
Del: useless -- https://master.php.net/note/delete/113262/useless
Del: bad code -- https://master.php.net/note/delete/113262/bad+code
Del: spam -- https://master.php.net/note/delete/113262/spam
Del: non-english -- https://master.php.net/note/delete/113262/non-english
Del: in docs -- https://master.php.net/note/delete/113262/in+docs
Del: other reasons-- https://master.php.net/note/delete/113262
Reject -- https://master.php.net/note/reject/113262
Search -- https://master.php.net/manage/user-notes.php