PHP str_rot13() Function
Example
Encode and decode the string:
<?php echo str_rot13("I love Shanghai"); echo "<br>"; echo str_rot13("V ybir Funatunv"); ?>
Definition and Usage
The str_rot13() function performs ROT13 encoding on the string.
ROT13 encoding moves each letter 13 letters forward in the alphabet. Numbers and non-alphabetic characters remain unchanged.
Tip:Encoding and decoding are done by the same function. If you pass the encoded string as a parameter, the original string will be returned.
Syntax
str_rot13(string)
Parameters | Description |
---|---|
string | Required. Specifies the string to be encoded. |
Technical Details
Return Value: | Returns the ROT13 version of the encoded string. |
PHP Version: | 4.2.0+ |
Update Log: | Before PHP 4.3,string Can also be modified, just like by reference passing. |