Star-Hide Email |
[eluser]Lucas3677[/eluser]
A pretty obscure function that can come in very handy at times. This helper function takes an email address and hides part of it with stars. Useful for password recovery on websites: "Your password has been emailed to you (fo***[email protected])". Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Edit: Updated, thanks m4rw3r!
[eluser]m4rw3r[/eluser]
The regex doesn't work for me, but after correcting it, it works (yours cannot handle dots/dashes in the mail addresses). This works: Code: \w{2}([\w.-]+)\w@.+ But this is twice as fast: Code: function star_email($email) |
Welcome Guest, Not a member yet? Register Sign In |