Which function is used to close a file in PHP?

  • close()
  • fclose()
  • end()
  • finish()
In PHP, the fclose() function is used to close a file. It takes the file handle obtained from fopen() as its parameter. This function releases the resources associated with the file and frees up memory. It is a good practice to close files after you have finished working with them to ensure proper cleanup and prevent resource leaks.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *