File put contents
17 Ⅴ 2010
file_put_contents() is in php nowadays, but if you’re on an old server you may need your own.
This simply checks if the function’s there, and if not it makes the function.
// Replacement for file_put_contents if it doesn't exist
if(!function_exists('file_put_contents')){
function file_put_contents($file, $data){
$fp = fopen($file, 'w');
fwrite($fp, $data);
fclose($fp);
}
}