menu

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()

Discuss Work Space

Answer: 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

Discuss Work Space

Answer: 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()

Discuss Work Space

Answer: 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()

Discuss Work Space

Answer: 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");

Discuss Work Space

Answer: option a

Explanation:

The correct way to write data to a file in PHP is fwrite($file, "data");


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now