note 43565 added to function.file-put-contents

From: Date: Fri, 25 Jun 2004 18:14:30 +0000
Subject: note 43565 added to function.file-put-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-71689@lists.php.net to get a copy of this message
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) { $h = @fopen($filename, 'w'); if ($h === false) { return false; } $bytes = fwrite($h, $data); fclose($h); return $bytes; } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.file-put-contents.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43565 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43565&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43565&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71689) next »