The documentation is a little confusing, and with the recent OO changes it adds a little more to the confusion.

I was curious whether you could pass an object through the user func, modify it in that callback and have the actual object updated or whether some cloning was going on behind the scenes.

<?phpclass Test{ var $sValue = 'abc';

function testing($objTest) {$objTest->sValue = '123'; } }

$obj = new Test();

call_user_func(array($obj, 'testing'), $obj);

var_dump($obj);

?>

This works as expected: The object is not cloned, and $sValue is properly set to '123'. With the OO changes in PHP 5, you don't need to do "function testing(&$objTest)" as it is already passed by reference.

If you pass a string as the callback function (i.e., 2nd parm to preg_replace_callback()), then PHP will interpret it as a function's name in the current scope -- and Main::dada_cb is not a valid function name in any scope.

If you want to specify a static method of a class as the callback (i.e., "Main::dada_cb"), then you must pass as 2nd parm to preg_replace_callback:

array( 'Main', 'dada_cb')

And, if you want to use as a callback some method of an instantiated object (i.e., $object->dada_cb), then you must pass as the 2nd parm to preg_replace_callback:

The mixed pseudotype is explained as meaning "multiple but not necessarily all" types, and the example of str_replace(mixed, mixed, mixed) is given where "mixed" means "string or array".Keep in mind that this refers to the types of the function's arguments _after_ any type juggling.

Parent methods for callbacks should be called 'parent::method', so if you wish to call a non-static parent method via a callback, you should use a callback of<? // always works $callback = array($this, 'parent::method')

// works but gives an error in PHP5 with E_STRICT if the parent method is not static $callback array('parent', 'method'); ?>