PHP : Function in preg_replace says that the function was already declared

voltaj

New Member
The Function:\[code\]function doSomething($url){ $url = "<a href=http://stackoverflow.com/"{$url}\" target=\"blank\" title=\"{$url}\">{$url}</a>"; return $url;}\[/code\]The replacement\[code\]$content = preg_replace("#(http:\/\/+[^\s]+)#ie","doSomething('$1')", $content);\[/code\]The Problem:\[quote\] Fatal error: Cannot redeclare doSomething() (previously declared in http://example.com/test.php:69) in http://example.com/test.php on line 69\[/quote\]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.
 
Back
Top