PHP fclose() Function
Definition and Usage
The fclose() function closes an open file.
Syntax
fclose(file)
Parameter | Description |
---|---|
file | Required. Specifies the file to be closed. |
Description
file The parameter is a file pointer. The fclose() function closes the file pointed to by the pointer.
If successful, it returns true; otherwise, it returns false.
The file pointer must be valid and obtained through fopen() or fsockopen() Successfully opened.
Example
<?php $file = fopen("test.txt","r"); //Some code to be executed... fclose($file); ?>