Automatic Mailto Links


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. $string = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','<a href="mailto:\\1">\\1</a>', $text);
  2. echo $string;

URL: http://css-tricks.com/snippets/php/automatic-mailto-links/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.