Instance
Encode and decode the string:
<?phpecho str_rot13 ("Hello World"), echo "<br>", Echo str_rot13 ("Uryyb jbeyq"); >
Definition and usage
The str_rot13 () function performs ROT13 encoding on the string.
ROT13 encoding is to get each letter in the alphabet by moving forward 13 letters. Numeric and non-alphabetic characters remain unchanged.
Tip: Both encoding and decoding are done by the same function. If you take an encoded string as an argument, the original string is returned.
Grammar
STR_ROT13 (String)
Parameters |
Describe |
String |
Necessary. Specifies the string to encode. |
Technical details
return value: |
Returns a ROT13 encoded string. |
PHP version: |
4.2.0+ |
Update log: |
Before PHP 4.3, a string could be modified, as if it were passed by reference. |
Instance
Encode and then decode the string:
<?phpecho str_rot13 ("I Love Shanghai"), echo "<br>", Echo str_rot13 ("V ybir FUNATUNV"); >
Results:
"; Echo str_rot13 ("V ybir FUNATUNV");?>