Re: file() and array values contain extra \n
| From: | Richard Lynch | Date: | Thu, 18 Jul 2002 23:03:56 +0000 |
| Subject: | Re: file() and array values contain extra \n | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108372@lists.php.net to get a copy of this message | ||
>$users=file('.users');
>fwrite ($fd, join("\n",$users));
file puts each line in a separate element of the array, but it does *NOT*
strip off the \n in doing so.
When you join them back together, *YOU* added an extra \n in the join.
You want join('', $users)
That will join them with no extra characters.
--
Like Music? http://l-i-e.com/artists.htm