note 61288 deleted from function.file-put-contents by aidan
| From: | aidan@php.net | Date: | Wed, 15 Feb 2006 22:53:34 +0000 |
| Subject: | note 61288 deleted from function.file-put-contents by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-103812@lists.php.net to get a copy of this message | ||
Note Submitter: oveaurs at gmail dot com
----
From previous comment:
for php4
<?php
function file_put_contents($file, $string) {
$f=fopen($file, 'a+');
ftruncate($f, 0);
fwrite($f, $string);
fclose($f);
}
?>
why not call fopen with 'w' instead of 'a+'? :
<?php
function file_put_contents($file, $string) {
$f=fopen($file, 'w');
fwrite($f, $string);
fclose($f);
}
?>