Make HyperLinks from Text using PHP

by Sasikumar 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;
}
619
like
0
dislike
0
mail
flag

You must LOGIN to add comments