The Function:
function doSomething($url){
$url = "<a href=\"{$url}\" target=\"blank\" title=\"{$url}\">{$url}</a>";
return $url;
}
The replacement
$content = preg_replace("#(http:\/\/+[^\s]+)#ie","doSomething('$1')", $content);
The Problem:
Fatal error: Cannot redeclare doSomething() (previously declared in http://example.com/test.php:69) in http://example.com/test.php on line 69
Note: The current function does not represent my real function, I know that for this situation I don't need any functions but in my real code I need. But this is a better example also.