note 44048 deleted from function.fwrite by aidan

From: Date: Thu, 26 Aug 2004 09:00:12 +0000
Subject: note 44048 deleted from function.fwrite by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75305@lists.php.net to get a copy of this message
Note Submitter: ramsey at php dot net ---- A rapid way to add content to a file is to use file_put_contents(), available in PHP 5. If you're using a version of PHP prior to 5, you may use PEAR::PHP_Compat, which provides this function. 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; } } ?>

« previous php.notes (#75305) next »