[Phpwm] Accessing class variable from sub function
Mike Tipping
mike at etuna.co.uk
Wed Apr 16 12:09:46 BST 2008
This is probably a silly question but I can't work it out.
I'm using preg_replace_callback which takes a callback function as a
parameter. The call to preg_replace_callback is within a class and I need
the callback function to have access to the classes properties, but can't
work out how to give it access.
So with something like this:
Class myclass {
public someData = array();
function replaceText($someText) {
function callbackFunc($matches) {
print_r(xxx);
}
reg_replace_callback('/{id="1"}/' ," callbackFunc", $fileContent);
}
}
What do I need to replace xxx with to access the array someData?
Or am I approaching this in completely the wrong way?
Cheers
Mike
More information about the Phpwm
mailing list