<?php
function fun_url($s)
{
return preg_replace("#(https?://\S*|www\.\S*|\S*\.(?:com|net|org)\S*)#", "<a href='$1'>$1</a>", $s);
}
$text = "This is a sample text contain link to google : google.com
It can also be http://yahoo.com or even www.experts-exchange.com";
echo fun_url($text);
?>
|