Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

fclose()

Example

Open the file “test.txt” and then close it.

<?php
$file = fopen(“test.txt”“r”);
fclose($file);
?>

Definition and Usage

The fclose() function closes an open file pointer.

 

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

Syntax

fclose(filepointer)

Parameter Values

Parameter

Description

filepointer

Mandatory. Specifies the file to be closed.

Technical Details

 

Return Value:

Returns TRUE on success and FALSE on failure.

PHP Version:

4.0+