My particular scenario involves doing some text transformation using regular expressions within a private method. The private method calls preg_replace_callback, but is seem
Yes, it seems you can:
test(); //this doesn't work $result = preg_replace_callback('/test/', array(new a(), 'replaceCallback'), ' test test '); echo $result;
So it seems that preg_replace_callback(), or PHP's callback mechanism, is aware of the scope in which it was called.
preg_replace_callback()
Tested on 5.2.8