Jump to: navigation, search

PHP File Close

From w3cyberlearnings

Contents

PHP close a File

You have to close a file after you have open or use it. It is a good practice to always close a file, because if you keep it open after you used it, the open file is still running on your server and it takes your server resources.

Syntax fclose

fclose(filehandle)

Example 1

<?php

$filename = "myfirstfile.txt";
$filehandle = fopen($filename, 'w') or die("can't open file");
fclose($filehandle);
?>

Related Links


  1. PHP File Linux vs. Windows
  2. PHP File Information
  3. PHP File Create
  4. PHP File Close
  5. PHP File Read
  6. PHP File Read Reverse
  1. PHP File Write
  2. PHP File Write to end or append to
  3. PHP File Write at Beginning
  4. PHP File Write at specific location
  5. PHP File Truncate
  6. PHP File Replace a specific word
  1. PHP File Replace a specific word with associative array
  2. PHP File Copy File
  3. PHP File Copy Reverse
  4. PHP File Search within file
  5. PHP File Delete File
  6. PHP File Template
  1. PHP File Email Template
  2. PHP File Template with MySQL
  3. PHP File Access with MySQL
Navigation
Web
SQL
MISC
References