PHP Write to File

A simple function that writes whatever you pass to it in a file.


Possibly you need to check your permissions in order for PHP to write to the file. This function will overwrite what's in the file if you call it again. Check PHP's site for fopen modes:

How to:

$str = 'This is a string...';
echo write_to_file('/home/tester/myfile.txt', $str);