note 90751 deleted from function.file-put-contents by danbrown
| From: | danbrown@php.net | Date: | Fri, 08 May 2009 02:36:20 +0000 |
| Subject: | note 90751 deleted from function.file-put-contents by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154340@lists.php.net to get a copy of this message | ||
Note Submitter: perberos at NOSPAM dot gmail dot com
----
lazy mode
<?php
if (!function_exists('file_get_contents')): function file_get_contents($filename)
{
$f = fopen($filename, 'r');
$content = '';
while (!feof($f))
$content .= fread($f, 1024);
fclose($f);
return $content;
} endif;
if (!function_exists('file_put_contents')): function file_put_contents($filename,
$content)
{
$f = fopen($filename, 'w');
fputs($f, $content);
ftruncate($f, ftell($f));
fclose($f);
} endif;
?>