Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

fclose

Description

The fclose of Filesystem for PHP closes an open file pointer.

Syntax

fclose(
    resource $stream
): bool

Parameters

stream

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

1 · stream

<?

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

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

    fpassthru($stream);

fclose($stream);

?>
hello

2 · return

<?

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

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

$return = fclose($stream);

var_export($return);

?>
true
HomeMenu