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.

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;


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.