Re: string concatenation with fgets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- On Wed, 11/25/09, aurfalien@xxxxxxxxx <aurfalien@xxxxxxxxx> wrote:

> From: aurfalien@xxxxxxxxx <aurfalien@xxxxxxxxx>
> Subject:  string concatenation with fgets
> To: php-general@xxxxxxxxxxxxx
> Date: Wednesday, November 25, 2009, 7:00 AM
> Hi all,
> 
> I'm trying to append some text to what I read from a file.
> 
> My code;
> 
> $file = fopen("foo.txt", "r");
> while (!feof($file)) {
>     $line = fgets($file);
>     print $line."sometext";
>     }
> fclose($file);
> 
> foo,txt;
> a
> b
> c
> d
> e
> f
> g
> 
> And when I run the script, it looks like;
> a
> sometextb
> sometextc
> sometextd
> ...
> 
> 
> Any ideas?
> 


So, what output you actually wants from your program?

Is it like this....
asometextbsometextcsometext......

or, like this....
asometext
bsometext
csometext


---
নির্মাল্য লাহিড়ী [Nirmalya Lahiri]
+৯১-৯৪৩৩১১৩৫৩৬ [+91-9433113536]




      

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux