PHP Write to File

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

Usage

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: http://www.php.net/manual/en/function.fopen.php

How to:


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

 

Comments