RE: [PHP] replacing a line in a file

2001-03-14 Thread Tim Ward
owing disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html > -Original Message- > From: enthalpy [mailto:[EMAIL PROTECTED]] > Sent: 13 March 2001 23:56 > To: Henrik Hansen > Cc: php general > Subject: Re: [PHP] replacing a line in a file >

Re: [PHP] replacing a line in a file

2001-03-13 Thread enthalpy
that could work but i dont want to append the new line a the bottom which it looks like thats what your doing. i need to replace the line where it is <-CoreComm-Internet-Services---http://core.com-> (Jon Marshall CoreComm Services Chicago) ([EMAIL PROTECTED] Syst

Re: [PHP] replacing a line in a file

2001-03-13 Thread Henrik Hansen
maybe this? while($line = fgets($fp, 1024)) { $line = str_replace("replace_this", "with_this", $line); $content .= $line; } fwrite($fp, $content); -- Henrik Hansen - Original Message - From: "enthalpy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 14, 2001 1

Re: [PHP] replacing a line in a file

2001-03-13 Thread Aviv Revach
Hey! I didn't try to analyze your code, but why not using the file() function which opens a file and puts it's content into an array. After doing that, you could seek that array line-by-line for "$data[0]:$shadow[1]" and replace it with $data[0]:$data[1]. Since you're dealing with full lines i