Examveda

The ........... function is used to read a single character from a file.

A. fgetc()

B. fgets()

C. fget()

D. fgetf()

Answer: Option A

Solution (By Examveda Team)

Option A: fgetc()
This function in PHP is used to read a single character from a file. It retrieves the next character from the file pointer and advances the file pointer position to the next character.

Option B: fgets()
The fgets() function is used to read a line from a file. It retrieves a line of text from the file pointer, including the newline character at the end of the line.

Option C: fget()
There is no fget() function in PHP related to file reading. This option is incorrect.

Option D: fgetf()
There is no fgetf() function in PHP related to file reading. This option is incorrect.

Conclusion:
The function used to read a single character from a file in PHP is fgetc() (Option A). This function is specifically designed to fetch individual characters from the file, making it the correct answer to the question.

This Question Belongs to PHP >> File System

Join The Discussion

Related Questions on File System