preg_replace_callback
Posted: Sat Jan 03, 2009 3:14 pm
Hi,
I didn't know how to put this in the title. I'm doing a preg_replace_callback to a function named callback_fix() within a class. Here's an example:
The problem is that I am using "$this ->" inside the callback function and therefore it will not work. I need to somehow refer to the $this. I know a few ways to do it, but I'm just wondering what's the best way to do it? (Fastest)
I didn't know how to put this in the title. I'm doing a preg_replace_callback to a function named callback_fix() within a class. Here's an example:
Code: Select all
class xxx
{
function do()
{
function callback_fix($matches)
{
return $this -> loader[$matches[1]];
}
preg_replace_callback(...,'callback_fix',...);
}
}