note 93385 added to function.str-rot13
| From: | peteratNOSPAMjamitdotcom at osu1 dot php dot net | Date: | Mon, 07 Sep 2009 08:11:17 +0000 |
| Subject: | note 93385 added to function.str-rot13 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-160272@lists.php.net to get a copy of this message | ||
Here is my ROT13 function that works for all possible characters and not just ASCII. It can be used
on Chinese, Japanese, ....
<?php
function rot13encrypt ($str) {
return str_rot13(base64_encode($str));
}
function rot13decrypt ($str) {
return base64_decode(str_rot13($str));
}
// example
$string = 'ä¸åæ¯æçå®¶';
$encrypted = rot13encrypt ($string); // produces 5Yvg5MlY5cvi5bvE55dR5n62
$decrypted = rot13decrypt ($encrypted); // produces ä¸åæ¯æçå®¶
?>
----
Server IP: 208.69.120.35
Probable Submitter: 202.66.128.121
----
Manual Page -- http://www.php.net/manual/en/function.str-rot13.php
Edit -- https://master.php.net/note/edit/93385
Del: integrated -- https://master.php.net/note/delete/93385/integrated
Del: useless -- https://master.php.net/note/delete/93385/useless
Del: bad code -- https://master.php.net/note/delete/93385/bad+code
Del: spam -- https://master.php.net/note/delete/93385/spam
Del: non-english -- https://master.php.net/note/delete/93385/non-english
Del: in docs -- https://master.php.net/note/delete/93385/in+docs
Del: other reasons-- https://master.php.net/note/delete/93385
Reject -- https://master.php.net/note/reject/93385
Search -- https://master.php.net/manage/user-notes.php