Quick Tip: PHP clearstatcache

Find the error:

72aaa2dbd201d49fc2ee429ebf68f15b


PHP caches the return values of stat() and thus, for example, the result of filesize(), so its multiple calls to the same file will always return the value of the first call, so in our case only the first three characters are read.

In order to change this behavior, it is generally recommended to always execute the clearstatcache () function after each fclose () (or file_put_contents () ), which clears this cache:

72aaa2dbd201d49fc2ee429ebf68f15b

Back