• PHP Video Tutorials

PHP - Function fclose()



The fclose() function closes any open file, and it returns true on success or false on failure.

Syntax

bool fclose ( resource $handle )

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

Example

<?php
   $handle = fopen("/PhpProject/sample.txt", "r");
   fclose($handle);
   echo "File closed succsssfully";
?>

Output

File closed succsssfully
php_function_reference.htm
Advertisements