Re: string concatenation with fgets
| From: | Shawn McKenzie | Date: | Mon, 30 Nov 2009 15:07:09 +0000 |
| Subject: | Re: string concatenation with fgets | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-300152@lists.php.net to get a copy of this message | ||
aurfalien@gmail.com wrote:
> So here is my final test code, notice the check for ' ' in the if.
>
> Since I'm on Linux, this has to do with whats between the last LF and
> EOF which is nothing but this nothing will get printed out.
>
> $file = fopen("somefile.txt", "r");
> while (! feof($file))
> {
$tmp = trim(fgets($file));
if ($tmp != '')
> {
$names = $tmp;
> }
> print $names."sometext\n";
> }
> fclose($file);
>
>
--
Thanks!
-Shawn
http://www.spidean.com