Clear cache in PHP

Description

The following code shows how to clear cache.

Example


<?php/*from  w  w  w  .  j  av a 2  s . c  om*/
    //check filesize
    echo filesize("test.txt");
    echo "<br />";

    $file = fopen("test.txt", "a+");
    // truncate file
    ftruncate($file,100);
    fclose($file);


    echo filesize("test.txt");

    //Clear cache and check filesize again
    clearstatcache();
    echo filesize("test.txt");
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    File »




Directory
DirectoryIterator
Drive
File
File Permission
File Read Save
FileSystemIterator
Path
Zip