The clearstatcache() function clears the file status cache.
PHP clearstatcache() Function has the following syntax.
clearstatcache()
Functions that are caching:
Clears the file status cache
<?php/*from w w w . j av a 2 s .co m*/
echo filesize("test.txt");
echo "\n";
$file = fopen("test.txt", "a+");
ftruncate($file,200);
fclose($file);
clearstatcache();
echo filesize("test.txt");
?>
The code above generates the following result.