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

Comment