How to Write to a file in PHP
The simplest way of writing to a file in php is using the fileputcontents function. This implicitly calls fopen, fwrite and fclose, as we know from e.g. c.
<?php file_put_contents("outfile.txt", "This is a string, but it could have been an array or a stream as well");