Thursday 15 July 2010

preg replace - How to use preg_replace instead of eregi php function -


When I went to a new server, the agri function generates a lot of errors, instead of preg_replace I like to use.

Here's my block of code:

  if ($ rstate & amp; amp;! Rcity & amp; amp;! Eregy ("outside", $ Rstate)) {$ h1title = str_replace ('ddd', $ tsstate, str_replace ('XXX', $ tsstate, $ pagetitlet)); Echo str_replace ('ddd', $ tsstate, str_replace ('XXX', $ tsstate, $ pagetitlet)); I've changed it: if ($ rstate & amp;!! $ Rcity & amp;! Preg_replace ("out", $ rstate)) {$ h1title = str_replace ('DDD', $ tsstate, str_replace ('XXX' $ Tsstate, $ pagetitlet)); Echo str_replace ('ddd', $ tsstate, str_replace ('XXX', $ tsstate, $ pagetitlet));   

But it is looking for another value. How do I add the third parameter of preg_replace to this function?

Thank you.

You do not need to use a regex for this test, instead use strokes :

  if ($ rstate & amp; amp;! Rcity & amp; amp; and; strokes ($ rstate, out ") === incorrect) {$ h1title = str_replace ( 'Ddd', $ tsstate, str_replace ('XXX', $ tsstate, $ pagetitlet)); Echo str_replace ('ddd', $ tsstate, str_replace ('XXX', $ tsstate, $ pagetitlet)); ...} < / Code>  

Note that the regex function you want

No comments:

Post a Comment