
#making use of file_get_contents() function by passing the path to the file where the file is present to read the contents of the file into a string called = file_get_contents('C:/Users/admin/Desktop/check2.txt') Then the contents of the file are displayed as the output on the screen. In the above program, we are making use of the file_get_contents() function by passing the path of the file where the files are present to read the contents of the file into a string called filecontents. #making use of file_get_contents() function by passing the path to the file where the file is present to read the contents of the file into a string called = file_get_contents('C:/Users/admin/Desktop/EDUCBA/check1.txt’) The output of the above program is as shown in the snapshot below: Print "The contents of the specified file is as follows:\n" #making use of file_get_contents() function by passing the path to the file where the file is present to read the contents of the file into a string called = file_get_contents('C:/Users/admin/Desktop/check.txt') PHP program to read the contents of the file present in the location whose path is passed as a parameter to the file_get_contents() function: Here are the following examples mention below Example #1

The path to the location where the file to be read is present is passed as a parameter to the file_get_contents() function.Whenever we want to read the contents of a file into a string in PHP, we use a function called file_get_contents() function.

Working of file_get_contents() function in PHP Where path_to_the_file is the path to the file where the files are present whose contents are to be read into a string by file_get_contents() function. Web development, programming languages, Software testing & others

Start Your Free Software Development Course
