PHP File Handling Interview Questions & Answers

PHP File Handling Interview Questions & Answers list

PHP File handling is an important part of any web application. You often need to open, edit, and delete a file for different tasks. PHP provides easy methods to work with files.

Here, we will provide a list of File Handling Interview Questions & Answers in PHP language.

Which is the PHP function to delete a file from server?

PHP has lots of inbuilt Functions. One of them is the unlink() PHP function which is used to delete a file from server. Example: unlink("sample-file.php")

What is fopen function PHP?

PHP fopen() is inbuilt function which is used to open a file or an URL.

<?php
$file_handle = fopen("sample-file.txt", "w");
?>

This function return FALSE and an error if fails to open a file.