views:

25

answers:

2

I saw code that contained the following line:

preg_replace_callback($regex, 'TextileParser::replaceAnchor', $text);

where TextileParser::replaceAnchor() is a private static method. Is that possible, or the code is wrong?

A: 

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.

karlw
Comments written on php.net are not verified; the fact somebody reported that code doesn't mean PHP allows to use a private static method as callback. I noted the code reported in that comment, but I have not noticed anything in the documentation that reports it's possible.
kiamlaluno
+1  A: 
NawaMan
I reinstalled the OS on my computer, and I still have to enable PHP on it. Thank you for your reply.
kiamlaluno
@kiamlaluno: Oh I see.
NawaMan