Which of the following functions can be used to read the contents of a file in PHP?
- fread() and file_get_contents()
- fwrite() and file_put_contents()
- fopen() and fclose()
- print() and echo()
The functions fread() and file_get_contents() can be used to read the contents of a file in PHP. fread() reads a file using a file pointer obtained from fopen(), while file_get_contents() reads the entire file into a string. The other options mentioned are not specifically used for reading file contents.
Loading...
Related Quiz
- What can be the potential issues with a for loop in PHP?
- You need to store a user's age in your PHP script. What data type would you use and why?
- You are writing a PHP script and you need to combine two strings into one. How would you do this?
- What is the difference between sort() and rsort() in PHP?
- A PHP class can have more than one constructor.