Re: file_set_contents() do several times?

From: Date: Mon, 20 Jul 2009 03:31:21 +0000
Subject: Re: file_set_contents() do several times?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-295599@lists.php.net to get a copy of this message
Martin Zvarík wrote:
<?php $i = 0; do { $i++; $r = file_put_contents('file.txt', 'content'); } while($r === false && $i < 3); if ($r === false) die('error'); ?> Makes sense? or is it enough to do it just once?
You call file_put_contents() once. it writes an entire file when called. use fopen/fwrite/fclose to do it line by line. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare

« previous php.general (#295599) next »