Convert text links to actual HTML links
This one liner will search a string and replace all links found in the text to a real html link.
$string = preg_replace("/(?:(http:\/\/)|(www\.))(\S+\b\/?)([ [:punct:]]*)(\s|$)/i","<a href=\"http://$2$3\">$1$2$3</a>$4$5", $string);