Re: Write RegExp-Vars in a function
| From: | Curt Zirzow | Date: | Mon, 01 Sep 2003 19:22:21 +0000 |
| Subject: | Re: Write RegExp-Vars in a function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161382@lists.php.net to get a copy of this message | ||
* Thus wrote Niels Uhlendorf (yushu@offucia.org):
> Hi,
>
> Although this seemed to be an easy prob I couldn't solve it in all the
> time.
>
> I have a function and a string i want to be replaced. I use preg_replace
> and get a var out. Now I want this var in the function but I don't know
> how I can get it in:
>
> preg_replace("#\[\+\+(.*)\+\+\]#Uis",my_function($1),$str); doesnt work
> at all and lots of other variations do not as well.
Your missing the /e modifier, and should quote the function (I
believe):
preg_replace("#\[\+\+(.*)\+\+\]#Uise",'my_function($1)',$str);
Curt
--
"I used to think I was indecisive, but now I'm not so sure."