timmah1 Posted May 25, 2010 Share Posted May 25, 2010 I"m trying to show an email address like [email protected] How can I replace everything after the @ in an email address with XX? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/202901-simple-replace/ Share on other sites More sharing options...
marcus Posted May 25, 2010 Share Posted May 25, 2010 <?php $email = "[email protected]"; list($user,$domain) = explode('@',$email); $chars = array_merge(range('a','z'),range(1,9),array('-','_')); echo $user . '@' . str_replace($chars,'X',strtolower($domain)); ?> results: [email protected] Link to comment https://forums.phpfreaks.com/topic/202901-simple-replace/#findComment-1063309 Share on other sites More sharing options...
timmah1 Posted May 25, 2010 Author Share Posted May 25, 2010 Thank you mgallforever Exactly what I was looking for Link to comment https://forums.phpfreaks.com/topic/202901-simple-replace/#findComment-1063312 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.