PHP fclose() Function

❮ PHP Filesystem Reference

Example

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 pointer.

Note: The file must have been opened by fopen() or fsockopen().

Syntax

fclose(filepointer)

Parameter Values

Parameter Description
filepointer Required. Specifies the file to close


Technical Details

Return Value: TRUE on success, FALSE on failure
PHP Version: 4.0+

❮ PHP Filesystem Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.