PHP 8.5.0 Beta 1 available for testing

Voting

: max(six, nine)?
(Example: nine)

The Note You're Voting On

John Crocker
5 years ago
The first example given may lead one to assume that this function works with a local filename e.g. $fs = filesize("error_log") but if you manually delete some text, then save and close the file, the next time you check filesize("error_log") it will return the original value, because the value is cached for performance reasons. If you didn't know this, it would look like a nasty bug.

So, everyone tells you to insert clearstatcache() which is supposed to clear the cached value and allow you to retrieve the current file size but it still does nothing and looks like another bug!

However, I found that if you always specify the FULL PATH
e.g. $fs = filesize("/user/some/path/error_log");
then clearstatcache() is not even needed.

<< Back to user notes page

To Top