Writing Files in PHP
Now let's learn how to write data
to files. For this purpose, the function
file_put_contents is used, which takes
the path to the file as the first parameter,
and the text we want to write as the second.
As an example, let's write some
text to the file test.txt:
<?php
file_put_contents('test.txt', '!');
?>
Given an array with numbers. Find the sum of these
numbers and write the result to the file sum.txt.