In PHP, the ______ function is used to read the contents of a file.

  • readfile()
  • file_get_contents()
  • fread()
  • include()
In PHP, the fread() function is used to read the contents of a file. It takes the file handle obtained from fopen() as the first parameter and the maximum number of bytes to read as the second parameter. This function returns the content of the file as a string. Alternatively, you can use file_get_contents() to read the entire file into a string or other file reading functions depending on your specific use case.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *