/ Published in: PHP
the POSIX Regex functions are deprecated in PHP 5.3.0 and removed in PHP 6.
http://us2.php.net/manual/en/function.eregi-replace.php
http://us2.php.net/manual/en/function.eregi-replace.php
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$string = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','<a href="mailto:\\1">\\1</a>', $text); echo $string;
URL: http://css-tricks.com/snippets/php/automatic-mailto-links/