fclose
PHP function
Edit on GitHub ✎
(PHP 4, PHP 5, PHP 7, PHP 8)
Closes an open file pointer
Description
fclose(resource $stream): bool
The file pointed to by stream is closed.
Parameters
streamThe file pointer must be valid, and must point to a file successfully opened by
fopen()orfsockopen().
Return Values
Success
Examples
A simple fclose() example
php
<?php
$handle = fopen('somefile.txt', 'r');
fclose($handle);
?>