note 50732 added to function.file-put-contents

From: Date: Tue, 08 Mar 2005 13:22:02 +0000
Subject: note 50732 added to function.file-put-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-86103@lists.php.net to get a copy of this message
This useful tip seems to have disappeared from here recently... To use file_put_contents prior to PHP5 and without having to upgrade/install PEAR, use this: if(!function_exists('file_put_contents')) { function file_put_contents($filename, $data, $file_append = false) { $fp = fopen($filename, (!$file_append ? 'w+' : 'a+')); if(!$fp) { trigger_error('file_put_contents cannot write in file.', E_USER_ERROR); return; } fputs($fp, $data); fclose($fp); } } ---- Manual Page -- http://www.php.net/manual/en/function.file-put-contents.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50732 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50732&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50732&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50732&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50732&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50732&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50732&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86103) next »