note 43565 deleted from function.file-put-contents by aidan
| From: | aidan@php.net | Date: | Thu, 05 Aug 2004 14:13:46 +0000 |
| Subject: | note 43565 deleted from function.file-put-contents by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74020@lists.php.net to get a copy of this message | ||
Note Submitter: ramsey@php.net
----
If you don't have PEAR::PHP_Compat or you don't want to use it for whatever reason,
here's my implementation of this function in versions of PHP < 5:
<?php
if (!function_exists('file_put_contents')) {
function file_put_contents($filename, $data)
{
if (($h = @fopen($filename, 'w')) === false) {
return false;
}
if (($bytes = @fwrite($h, $data)) === false) {
return false;
}
fclose($h);
return $bytes;
}
}
?>