PHP clearstatcache() Function
In this chapter you will learn:
- Definition for PHP clearstatcache() Function
- Syntax for PHP clearstatcache() Function
- Note for PHP clearstatcache() Function
- Example - clears the file status cache
Definition
The clearstatcache() function clears the file status cache.
Syntax
PHP clearstatcache() Function has the following syntax.
clearstatcache()
Note
Functions that are caching:
- stat()
- lstat()
- file_exists()
- is_writable()
- is_readable()
- is_executable()
- is_file()
- is_dir()
- is_link()
- filectime()
- fileatime()
- filemtime()
- fileinode()
- filegroup()
- fileowner()
- filesize()
- filetype()
- fileperms()
Example
Clears the file status cache
<?php/*from j a v a 2s . c o 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.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP closedir() Function
- Syntax for PHP closedir() Function
- Parameter for PHP closedir() Function
- Example - Open a directory, read its contents, then close
Home » PHP Tutorial » PHP File Functions