I saw code that contained the following line:
preg_replace_callback($regex, 'TextileParser::replaceAnchor', $text);
where TextileParser::replaceAnchor()
is a private static method.
I saw code that contained the following line:
preg_replace_callback($regex, 'TextileParser::replaceAnchor', $text);
where TextileParser::replaceAnchor()
is a private static method.
Yes, it is possible.
Just test it yourself:
<?php
class TestCallBack { private static function found_number($num) { return "-".$num[0]."-"; } public function find($Str) { return preg_replace_callback('/[0-9]/', 'TestCallBack::found_number', $Str); } } // Exemple $Tester = new TestCallBack; $Result = $Tester->find("54321"); var_dump($Result);
on php's website, there's this example:
http://www.php.net/manual/en/function.preg-replace-callback.php#96899
I'd assume if it's on php.net, then it's good to go.