Re: Re: Help with preg_replace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/11/2007, Jochem Maas <jochem@xxxxxxxxxxxxx> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux