The fclose() file system function in PHP will close a specified open file handler.
<?php
// Create the file handler
$fileHandler = fopen("myfile.txt", "w");
// Write to the file
fwrite($fileHandler, "Hello World");
// Close the file handler
fclose($fileHandler);
// Access the file data and echo it
$data = file_get_contents("myfile.txt");
echo $data;
?>
Hello World