Re: preg_replace

From: Date: Mon, 08 Oct 2001 10:21:03 +0000
Subject: Re: preg_replace
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70341@lists.php.net to get a copy of this message
I found that preg_replace_callback() maybe will suit to your needs but I 've used it. preg_match_all($pattern,$the_page,$matches,PREG_PATTERN_ORDER); foreach ($matches[1] as $key=>$value){ $the_page=str_replace($matches[0][$key],implode(file('',$value),$the_page); } Hope this helps. Andrey Hristov IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.com On Monday 08 October 2001 12:59, you wrote: > How to do something like : > > $text_of_template=preg_replace("~\[\*\*phpsrc\*\*[ ]*(.*)[ > ]*\]~si","<pre>". > implode(file("\\1"))."</pre>",$text_of_template); > > i.e. how one can change [**phpsrc** name.php ] in text of template to text > of php script > ..., > i think of using preg_* functionms but i don't know howto use functions on > it's "second" argument's. > Help me please... --

« previous php.general (#70341) next »