note 71408 added to function.str-replace

From: Date: Mon, 27 Nov 2006 21:32:17 +0000
Subject: note 71408 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-120108@lists.php.net to get a copy of this message
I create a little function to transform (to example) "User@example.net" in "user AT example DOT net" and conversely. <?php function code_mail($email) { if(preg_match('^.+@.+\..{1,5}$', $email)) { //email format $email = str_replace('.', ' DOT ', $email); //replace . by dot $email = str_replace('@', ' AT ', $email); //replace @ by at return $email; } else { //not email format return false; } } function decode_mail($email) { //on décode... $email = str_replace(' DOT ', '.', $email); //replace dot by . $email = str_replace(' AT ', '@', $email); //replace at by @ return $email; } ?> ---- Server IP: 195.221.21.36 Probable Submitter: 86.70.215.16 ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- https://master.php.net/note/edit/71408 Del: integrated -- https://master.php.net/note/delete/71408/integrated Del: useless -- https://master.php.net/note/delete/71408/useless Del: bad code -- https://master.php.net/note/delete/71408/bad+code Del: spam -- https://master.php.net/note/delete/71408/spam Del: non-english -- https://master.php.net/note/delete/71408/non-english Del: in docs -- https://master.php.net/note/delete/71408/in+docs Del: other reasons-- https://master.php.net/note/delete/71408 Reject -- https://master.php.net/note/reject/71408 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120108) next »