Using preg_replace_callback on class methods
To prevent an error likeĀ preg_replace_callback() [function.preg-replace-callback]: Requires argument 2, ‘function_name’, to be a valid callback, use the following snippet:
'((http(s?)\://){1}\S+)',
array(get_class($this), 'function_name'),
$text
);
The trick is to call the method like so:
I am a .NET programmer first and foremost. But in my spare time I like to play around with PHP, Erlang, Haskell, F#,