Re: Re: Help with preg_replace

From: Date: Thu, 08 Nov 2007 09:31:11 +0000
Subject: Re: Re: Help with preg_replace
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-264212@lists.php.net to get a copy of this message
On 08/11/2007, Jochem Maas <jochem@iamjochem.com> wrote: > Al wrote: > > Delimiters needed. Can use about anything not already in your pattern. > > "/" is very commonly used; but I like "#" or "%" generally; > > but, you > > can't use "%" because your pattern has it. > > > > $html = preg_replace("#%ResID#",$bookid,$html); > > wont a str_replace() do just fine in this case? > > // and we can do backticks too ;-) > $html = str_replace("%ResID", $bookid, cat htmlfile); As Jochem said. But don't use backticks, use file_get_contents(). It's portable and you don't start up a new process just to read a file. $html = str_replace('%ResID', $bookid, file_get_contents('htmlfile')); -robin

« previous php.general (#264212) next »