Menu Home

fclose

osbo.com | PHP | Functions | fclose

Closes an open file pointer

Syntax

fclose ( resource $handle ) : bool

Parameters

handle

The file pointer must be valid, and must point to a file successfully opened by fopen() or fsockopen().

Return

Returns TRUE on success or FALSE on failure.

Examples

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/file.txt';
$mode = 'r';

$handle = fopen($filename, $mode);

    fpassthru($handle);

fclose($handle);

?>
Hello

PHP