look at this and help me to fix this as work..this was not worked..
$text = "Hello I am the PHP.go from here http://php.net"
$pattern = "/http:\/\/(www\.)?([^.]+\.[^.\s]+\.?[^.\s]*)/i";
$replace = "<a href='http://\\1\\2'>http://\\1\\2</a>";
$string = preg_replace($pattern,$replace,$text);
echo $string;
this is the error it shows.
Parse error: syntax error, unexpected '$pattern' (T_VARIABLE) in