menu

PHP File Handling

PHP File Handling - Important Points


1. What is the function used to open a file in PHP?

A. fopen()

B. readfile()

C. fwrite()

D. fclose()

Discuss Work Space

Answer: option a

Explanation:

fopen() is the function used to open a file in PHP. It returns a file pointer, which is used in other functions like fwrite(), fgets(), etc.

2. What is the mode used for opening a file in PHP for reading only?

A. r

B. w

C. a

D. x

Discuss Work Space

Answer: option a

Explanation:

The mode used for opening a file in PHP for reading only is "r".

3. What is the mode used for opening a file in PHP for writing only?

A. w

B. r

C. a

D. x

Discuss Work Space

Answer: option a

Explanation:

The mode used for opening a file in PHP for writing only is "w".

4. Which function is used to write data to a file in PHP?

A. fwrite()

B. fread()

C. fopen()

D. fclose()

Discuss Work Space

Answer: option a

Explanation:

fwrite() is the function used to write data to a file in PHP.

5. What is the function used to read data from a file in PHP?

A. fgets()

B. fwrite()

C. fopen()

D. fclose()

Discuss Work Space

Answer: option a

Explanation:

fgets() is the function used to read data from a file in PHP.


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