1.

Which one of the following function is capable of reading a file into a string variable?(a) file_contents()(b) file_get_contents()(c) file_content()(d) file_get_content()This question was addressed to me during an internship interview.Asked question is from File System and PHP in section File and Session Handling in PHP of PHP

Answer»

The correct choice is (b) file_get_contents()

To explain I would say: The function file_get_contents() reads a file into a string. This is the PREFERRED way to read the contents of a file into a string as it will use memory MAPPING TECHNIQUES.



Discussion

No Comment Found

Related InterviewSolutions