Encode and decode strings:
<?phpecho str_rot13("Hello World");echo "<br>";echo str_rot13("Uryyb Jbeyq");?>The str_rot13() function performs ROT13 encoding on a string.
ROT13 encoding is obtained by moving each letter forward 13 letters in the alphabet. Numeric and non-alphabetic characters remain unchanged.
Tip: Encoding and decoding are both done by the same function. If you pass an encoded string as a parameter, the original string will be returned.
str_rot13( string )
parameter | describe |
---|---|
string | Required. Specifies the string to be encoded. |
Return value: | Returns a ROT13 encoded string. |
---|---|
PHP version: | 4.2.0+ |
Update log: | Prior to PHP 4.3, strings could be modified as if passed by reference. |