PHP fclose() Function
❮ PHP Filesystem ReferenceExample
Open and close file "test.txt":
<?php
$file = fopen("test.txt", "r");
fclose($file);
?>
Run Example »
Definition and Usage
The fclose() function closes an open file.
Note: The file must have been opened by fopen() or fsockopen().
Syntax
fclose(file)
Parameter Values
Parameter | Description |
---|---|
file | Required. Specifies the file to close |
Technical Details
Return Value: | TRUE on success, FALSE on failure |
---|---|
PHP Version: | 4.0+ |
❮ PHP Filesystem Reference