On Thu, 20 Feb 2003, Sara Golemon wrote:
>I recall a discussion sometime back about making file_put_contents() (create
>a file and write the provided contents to it in one command) and
>file_add_contents() (like put but append rather than overwrite) to
>complement file_get_contents() but looking in HEAD I don't see either put or
>add.
It sure would be nice to have..but why not just one function:
bool file_write_content(string filename, string data [, bool append [, bool
use_include_path]]);
Then you could do something like this:
<?php file_write_content('foobar.txt', 'foo!', file_exists('foobar.txt')); ?>
Short and simple. With separate functions:
<?php
file_exists('foobar.txt') ?
file_append_content('foobar.txt', 'foo!') :
file_put_content('foobar.txt', 'foo!');
?>
btw. Why is that file_get_contents() named like that?
Wouldn't it better be 'file_read_content()'?
--Jani
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php