> <?php
> if ( !function_exists('file_put_contents') && !defined('FILE_APPEND') )
> {
> define('FILE_APPEND', 1);
> function file_put_contents($n, $d, $flag = false)
> {
> $mode = ($flag == FILE_APPEND || strtoupper($flag) == 'FILE_APPEND') ?
> 'a' : 'w';
> $f = @fopen($n, $mode);
> if ($f === false)
> {
> return 0;
> }
> else
> {
> if (is_array($d))
> {
> $d = implode($d);
> }
> $bytes_written = fwrite($f, $d);
> fclose($f);
> return $bytes_written;
> }
> }
> }
> ?>
A foot note here:
Why using implode? That doubles memory usage. If is array fwrite foreach
else just write it. just 2 more lines of code. recursive arrays are
normally not written to a file with file_put_contents so it should be
fine. ;)
------------------------------------
Please remember to write your response BELOW the previous text.
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-listYahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/php-list/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/