Make HyperLinks from Text using PHP
by Sasikumar[ Edit ] 2014-01-09 15:56:57
To convert a text link into hyperlink use the following function :
This function also converts email-ids to mailto links.
function make_links($link_text)
{
$link_text = str_replace('www.', 'http://www.', $link_text);
$link_text = preg_replace('|http://([a-zA-Z0-9-./?=&]+)|','
$link_text = preg_replace('/(([a-z0-9+_-]+)(.[a-z0-9+_-]+)*@([a-z0-9-]+.)+[a-z]{2,6})/','
return $link_text;
}