Text URL to HTML

<?php
function to_link($string){
return preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", ‘<a href="$1://$2">$1://$2</a>$3’,$string);
}

$html = ‘This line of text has three

Powered by Gewgley