Re: [PHP] string concatenation with fgets

2009-11-30 Thread Ashley Sheridan
On Mon, 2009-11-30 at 09:40 -0800, aurfal...@gmail.com wrote: > Hi Ash, > > Actually I need the if because the code will print out an empty line > and add "sometext" to it. > > So without the if check for an empty line, at the end of the loop I'll > get sometext. For example, if the file I

Re: [PHP] string concatenation with fgets

2009-11-30 Thread aurfalien
Hi Ash, Actually I need the if because the code will print out an empty line and add "sometext" to it. So without the if check for an empty line, at the end of the loop I'll get sometext. For example, if the file I am processing called somename.txt has a b c in it. I'll have; asomet

Re: [PHP] string concatenation with fgets

2009-11-30 Thread Ashley Sheridan
On Mon, 2009-11-30 at 09:04 -0800, aurfal...@gmail.com wrote: > Hi Shawn, > > Your code looks cleaner then mine so i tried it and got the last entry > in the txt file printed twice. > > > On Nov 30, 2009, at 7:07 AM, Shawn McKenzie wrote: > > > aurfal...@gmail.com wrote: > >> So here is my f

Re: [PHP] string concatenation with fgets

2009-11-30 Thread aurfalien
Hi Shawn, Your code looks cleaner then mine so i tried it and got the last entry in the txt file printed twice. On Nov 30, 2009, at 7:07 AM, Shawn McKenzie wrote: aurfal...@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

Re: [PHP] string concatenation with fgets

2009-11-30 Thread Shawn McKenzie
aurfal...@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)) >

Re: [PHP] string concatenation with fgets

2009-11-26 Thread aurfalien
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)) { $names = trim(fgets(

Re: [PHP] string concatenation with fgets

2009-11-24 Thread aurfalien
On Nov 24, 2009, at 5:52 PM, ryan wrote: Is this what you want $file = fopen("test.txt", "r"); while (!feof($file)) { $line = trim(fgets($file)); print $line."sometext\n"; } fclose($file); outputs asometext bsometext csometext Ref to http://us3.php.net/manual/en/function.fgets.php. "Rea

Re: [PHP] string concatenation with fgets

2009-11-24 Thread aurfalien
On Nov 24, 2009, at 5:55 PM, Nirmalya Lahiri wrote: --- On Wed, 11/25/09, aurfal...@gmail.com wrote: From: aurfal...@gmail.com Subject: [PHP] string concatenation with fgets To: php-general@lists.php.net Date: Wednesday, November 25, 2009, 7:00 AM Hi all, I'm trying to append some text to w

Re: [PHP] string concatenation with fgets

2009-11-24 Thread Nirmalya Lahiri
--- On Wed, 11/25/09, aurfal...@gmail.com wrote: > From: aurfal...@gmail.com > Subject: [PHP] string concatenation with fgets > To: php-general@lists.php.net > 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; > >

Re: [PHP] string concatenation with fgets

2009-11-24 Thread ryan
Is this what you want $file = fopen("test.txt", "r"); while (!feof($file)) { $line = trim(fgets($file)); print $line."sometext\n"; } fclose($file); outputs asometext bsometext csometext Ref to http://us3.php.net/manual/en/function.fgets.php. "Reading ends when /length/ - 1 bytes have

Re: [PHP] string concatenation from array

2003-08-14 Thread Peter James
ntoy'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, August 12, 2003 2:00 PM Subject: RE: [PHP] string concatenation from array > Use the "." concatenation operator. : ) > > > $wresult = ""; > > foreach ($search_string as

RE: [PHP] string concatenation from array

2003-08-14 Thread Matt Giddings
Use the "." concatenation operator. : ) $wresult = ""; foreach ($search_string as $word_result) { $wresult = $wresult . " " . $word_result; } echo $wresult; Matt > -Original Message- > From: Micah Montoy [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 12, 2003 3:58 PM > To: [EMAI

Re: [PHP] string concatenation from array

2003-08-14 Thread CPT John W. Holmes
From: "Jonathan Pitcher" <[EMAIL PROTECTED]> > The & sign in PHP (to the best of my knowledge) does not concatenate. Correct, it's a bitwise AND operator. http://us2.php.net/manual/en/language.operators.bitwise.php ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubsc

RE: [PHP] string concatenation from array

2003-08-14 Thread Chris W. Parker
Analysis & Solutions on Tuesday, August 12, 2003 1:02 PM said: > OR you can do... > $wresult .= $word_result; Don't forget the space: $wresult .= " ".$word_result; c. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net

Re: [PHP] string concatenation from array

2003-08-14 Thread Peter James
hparch.com - Original Message - From: "Peter James" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, August 12, 2003 2:18 PM Subject: Re: [PHP] string concatenation from array > My personal favourite is to use an array. It's much cleaner syntax IMO...it >

Re: [PHP] string concatenation from array

2003-08-14 Thread Jonathan Pitcher
Micah, The & sign in PHP (to the best of my knowledge) does not concatenate. Use a . instead. See below. $wresult = ""; foreach ($search_string as $word_result){ $wresult .= $word_result; } That should work for you. Jonathan Pitcher On Tuesday, August 12, 2003, at 02:58 PM, Micah

Re: [PHP] string concatenation from array

2003-08-14 Thread Analysis & Solutions
On Tue, Aug 12, 2003 at 01:58:21PM -0600, Micah Montoy wrote: > I'm having a bit of difficulty getting a string to attach to itself from an > array. Here is the bit of code I'm working on. > A bunch of simplifications, efficiency tweaks on this approach... > $wresult = ""; $wresult = ''; >

RE: [PHP] string concatenation

2001-07-25 Thread Seb Frost
PROTECTED]] Sent: 26 July 2001 02:10 To: Seb Frost; PHP Subject: Re: [PHP] string concatenation On Thu, 26 Jul 2001 06:54, Seb Frost wrote: > OK let's say in variable $search I have the string "color" (without the > quote marks). > > now I want to be able to refer to the v

Re: [PHP] string concatenation

2001-07-25 Thread David Robley
On Thu, 26 Jul 2001 06:54, Seb Frost wrote: > OK let's say in variable $search I have the string "color" (without the > quote marks). > > now I want to be able to refer to the variable $color in my code. > > How in gods name do I do this. I guess somehow I have to combine a "$" > with the content