note 20860 added to function.strtr

From: Date: Fri, 19 Apr 2002 01:33:11 +0000
Subject: note 20860 added to function.strtr
Groups: php.notes 
Request: Send a blank email to php-notes+get-29563@lists.php.net to get a copy of this message
As noted in the str_rot13 docs, some servers don't provide the str_rot13() function. However, the presence of strtr makes it easy to build your own facsimile thereof: if (!function_exists('str_rot13')) { function str_rot13($str) { $from = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $to = 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'; return strtr($str, $from, $to); } } This is suitable for very light "encryption" such as hiding email addressess from spambots (then unscrambling them in a mail class, for example). $mail_to=str_rot13("$mail_to"); -- http://www.php.net/manual/en/function.strtr.php http://master.php.net/manage/user-notes.php?action=edit+20860 http://master.php.net/manage/user-notes.php?action=delete+20860 http://master.php.net/manage/user-notes.php?action=reject+20860

« previous php.notes (#29563) next »