How to Write to a file in PHP Posted in Polyglotbits on 03 of Dec, 2015

The simplest way of writing to a file in php is using the file_put_contents function. This implicitly calls fopen, fwrite and fclose, as we know from e.g. c.

file_put_contents("outfile.txt", "This is a string, but it could have been an array or a stream as well");

More about PHP