Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP str_rot13() Function

PHP str_rot13() Function

PHP String Reference Manual PHP String Reference Manual

Example

Encode and decode a string:

"; echo str_rot13("Uryyb Jbeyq"); ?>

Run Example »


Definition and Usage

The str_rot13() function performs ROT13 encoding on a string.

ROT13 encoding shifts each letter 13 positions forward in the alphabet. Digits and non-letter characters remain unchanged.

**Tip:** Encoding and decoding are both done by the same function. If you pass an already-encoded string as a parameter, the original string is returned.


Syntax

str_rot13(

string

)

Parameters Description
string Required. Specifies the string to encode.

Technical Details

Return Value: Returns the ROT13-encoded string.
PHP Version: 4.2.0+
Changelog: Before PHP 4.3,string could be modified, as if passed by reference.

PHP String Reference Manual PHP String Reference Manual