With this function you can make clickable text to links.
Function:
Function:
<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.in/ */ function dolinks($text) { $text = html_entity_decode($text); $text = " ".$text; $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1', $text); $text = eregi_replace('(((f|ht){1}tps://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1', $text); $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1\\2', $text); $text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', '\\1', $text); return $text; } // Example Usage echo dolinks("This is a test clickable link: http://4evertutorials.blogspot.in/ You can also try using an email address like username@example.com"); ?>
0 comments:
Post a Comment