2009/7/20 Martin Zvarík <mzva...@gmail.com>:
>
> <?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?

Assuming 'content' changes, and this is the cut-down example...

$r = file_put_contents('file.txt', 'content', FILE_APPEND);

There's a small overhead in opening/closing the file three times
instead of one, but I doubt that's going to be an issue for you.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to