Re: Search & replace text

From: Date: Mon, 12 Feb 2001 13:50:30 +0000
Subject: Re: Search & replace text
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-39257@lists.php.net to get a copy of this message
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: > $new_line = str_replace($oldemail, $newemail, $line); Another little thing: You don't need the eregi() here - just do str_replace. If it doesn't find $oldemail it won't do anything. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Nothing is more dangerous than an idea if it's the only one you have. - Emil-Auguste Chartier, "Propos sur la religion", 1938

« previous php.general (#39257) next »