Read and Write file in PHP

Write to File from PHP:

From PHP you are able to open up a file on your server and
write to it. If the file does not exist then we can create it, however if the
file already exists then you must open in append mode so it will be writable. When
writing to a file, the first thing you need to do is to open up the file. We do
that with this code: