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);