Php > Code Snippets
Convert links into clickable hyperlinks
Convert links into clickable hyperlinks phpfunction makeClickableLinks($text) { $text = eregi_replace('(((f|ht){1}tp://)[-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;} // Usage// Email address example$text = "you@example.com";echo makeClickableLinks($text);echo "
"; // URL example$text = "http://www.example.com";echo makeClickableLinks($text); echo "
";// FTP URL example$text = "ftp://ftp.example.com";echo makeClickableLinks($text); ?>
Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage