RE: [PHP] Search & replace text

2001-02-13 Thread PHPBeginner.com
Sorry, I made a small mistake in my code ... this is correct: $contents = file ($file); for($i=0; $imailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 11:34 PM To: PHP; CDitty Subject: RE: [PHP] Search & replace text ok, here's a scratch: $contents = file ($file); for($i=0;

RE: [PHP] Search & replace text

2001-02-13 Thread PHPBeginner.com
ok, here's a scratch: $contents = file ($file); for($i=0; $imailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 3:29 AM To: PHPBeginner.com Subject: RE: [PHP] Search & replace text Thanks for the idea. Can you give me an example of how to load a file into an array? My effor

Re: [PHP] Search & replace text

2001-02-12 Thread Christian Reiniger
On Monday 12 February 2001 01:22, David Robley wrote: > > while (!feof($file)) { > > $line = fgets($file, 255); > > if(eregi($oldemail, $line, $out)) { > > str_replace($oldemail, $newemail, $line); > > You need to assign the output of this function to a string: >

RE: [PHP] Search & replace text

2001-02-12 Thread PHPBeginner.com
instead of writing to you the code I'll give you an idea: 1. you open the file and read it line-by-line assigning it to an array, 2. you loop that array parsing it line by line changing it's values with RegEx the way you want. 3. you open the same file and, looping the array writing it down overr

Re: [PHP] Search & replace text

2001-02-11 Thread David Robley
On Mon, 12 Feb 2001 06:41, CDitty wrote: > Hello all. I am trying to search through a text file on my server to > replace the user email. I can open the file and read it, but cannot > get it to "find" the actual string and replace it. Can someone look > over my code and see what the problem is?