PHP File Handling
PHP File Handling - Important Points
6. | What is the function used to close a file in PHP? |
---|
A. fclose()
B. fopen()
C. fwrite()
D. fread()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
fclose() is the function used to close a file in PHP.
7. | What is the mode used for opening a file in PHP for appending data? |
---|
A. a
B. r
C. w
D. x
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The mode used for opening a file in PHP for appending data is "a".
8. | What is the function used to check if a file exists in PHP? |
---|
A. file_exists()
B. file_open()
C. file_close()
D. file_read()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
file_exists() is the function used to check if a file exists in PHP.
9. | What is the function used to delete a file in PHP? |
---|
A. unlink()
B. delete()
C. remove()
D. erase()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
unlink() is the function used to delete a file in PHP.
10. | Which of the following is the correct way to write data to a file in PHP? |
---|
A. fwrite($file, "data");
B. fread("data", $file);
C. fwrite("data", $file);
D. fread($file, "data");
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The correct way to write data to a file in PHP is fwrite($file, "data");