PHP File Close
The opposite of the fopen() function is fclose(), which will close an already opened file.
You must always remember to close a file once its been opened and all the functions that needed to be done with the file have completed. Once you close the file using the fclose function, the only action you can perform with the file is to delete it.
An example of using fclose() to close a file is as simple as:
$file=fopen(“myfile.txt”,”r+”) or die(“myfile.txt does not exist!”);
fclose($file);
This bit of code would simply close the myfile.txt, which was given the variable $file when opened.




