Re: array to string
| From: | R'twick Niceorgaw | Date: | Fri, 19 Oct 2001 18:25:50 +0000 |
| Subject: | Re: array to string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71612@lists.php.net to get a copy of this message | ||
try this
$fupdatecontents='';
while ( list($key,$value) = each($fcontents) ) {
$fupdatecontents .=$value;
}
$fcontents = $fupdatecontents;
or just write $fupdatecontents into the file.
You may need to add a \n after each line ( which I'm not sure);. If you need
you can change the
$fupdatecontents .=$value;
line to
$fupdatecontents .=$value."\n";
HTH
R'twick
----- Original Message -----
From: "René Fournier" <renefournier@yahoo.com>
To: "Php-General" <php-general@lists.php.net>
Sent: Friday, October 19, 2001 12:05 PM
Subject: [PHP] array to string
> Just trying to convert an array to string before writing the whole thing
> back out to a file. (Trying to do a simple database-less database, using
> text files).
>
> $fcontents = file($name.".db"); // THE ENTIRE TABLE
> $fcontents[$update] = $updatedstring; // THE ROW TO BE UPDATED
> $fp = fopen($name.".db", "w+");
>
> But before the next line, I need to convert $fcontents to a string, else
> just "Array" gets written to the text file. I just can't seem to find the
> sure-to-be simple command to do this on php.net or phpbuilder.com, etc.
Any
> ideas?
>
> fwrite($fp,$fcontents);
> fclose($fp);
>
> Thanks.
>
> ...Rene
>
> ---
> Rene Fournier
> renefournier@yahoo.com
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>