Extend support by converting anonymous functions.

Convert anonymous function used for preg_replace_callabck to be methods to extend support for pre 5.3.0 php.