Here is a small piece of code which converts url in a string into a hyperlink:
$str = preg_replace("/((ftp)|(http(s?))\:\/\/(([A-z0-9\?\=\-\:\;\.\@\/]+)))/is",'<a href="\\0">\\0</a>',$str);
example:
$str = 'http://conding-talk.com is the best coding site.';
$str = preg_replace("/((ftp)|(http(s?))\:\/\/(([A-z0-9\?\=\-\:\;\.\@\/]+)))/is",'<a href="\\0">\\0</a>',$str);
echo $str;
and the output will be:
<a href="http://conding-talk.com">http://conding-talk.com</a> is the best coding site.
Advertise your mobile site for FREE with AdTwirl