return preg_replace("/(http|ftp|https):\/\/([^\s]+)/", "<a target=\"_blank\" href=\"http://$2\">$2</a>",$str);
function makelink($url, $limit=50){ $text = strlen($url) > $limit ? substr($url, 0, $limit).'...' : $url; return "<a href='$url' target='_blank'>$text</a>"; } echo makelink("http:\\www.google.com", 10);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)