Reading Files in PHP
The function file_get_contents allows
reading a file. The function takes the filename
as a parameter and returns the text of that file
as its result.
Let's see it in practice. Suppose we have
a file index.php, which we access
through the browser. Let also in this
same folder there is a file test.txt.
Let's read the text of the text file and display this text on the screen:
<?php
echo file_get_contents('test.txt');
?>
Suppose you have files 1.txt and 2.txt,
in which some numbers are written.
Write a script that will display
the sum of the numbers written in these files.