It flushes the output to a file
Example
<?php
$filename = ‘test.txt’;
$file = fopen($filename, ‘r+’);
fwrite($file, ‘phpcodez’);
fflush($file);
?>
It flushes the output to a file
Example
<?php
$filename = ‘test.txt’;
$file = fopen($filename, ‘r+’);
fwrite($file, ‘phpcodez’);
fflush($file);
?>
It checks for end-of-file on a file pointer
Example
<?php
$fp = fopen(‘test.txt’, ‘r’);
while (!feof($fp)) {
}
fclose($fp);
?>
It closes an open file pointer
Example
<?php
$fp = fopen(‘test.txt’, ‘r’);
fclose($fp);
?>
Its an alias of disk_free_space() and returns available space on filesystem or disk partition
Example
<?php
echo diskfreespace(“/”);
?>
Output
200833871872
It returns the total size of a filesystem or disk partition
Example
<?php
echo disk_total_space(“/”);
?>
Output
239940263936
It returns available space on filesystem or disk partition
Example
<?php
echo disk_free_space(“/”);
?>
Output
200834342912
It returns parent directory’s path
Example
<?php
echo dirname(“/var/www”);
?>
Output
/var
Check unlink() or unset()
It can be used to copy file
Example
<?php
copy(“test.txt”,”test.txt.new”) or die(“Failed to copy the file”);
?>
It can be used to clears file status cache
Example
<?php
clearstatcache();
?>