Home >>PHP String Functions >PHP str_rot13() Function
PHP str_rot13() function is used to perform ROT13 encoding on a given input string. In this encoding it shifts every alphabet present in the input string by 13 places in the alphabet and the numeric and non-alphabetical characters remains same. If we pass the encoded string to this function it will return the decoded string.
Syntax:
str_rot13( $string );
Parameter | Description |
---|---|
string | This is a required parameter. This parameter contains the string to be encoded. |
Here is an example of str_rot13() function in PHP:
<html> <body> <?php echo str_rot13("PHPTPOINT"); echo "<br>"; echo str_rot13("CUCGCBVAG"); ?> </body> </html>
Here is an example of str_rot13() function in PHP:
<html> <body> <?php $str1 = "Hello Everyone!!!"; $str2 = "This is 2020."; echo str_rot13($str1); echo "<br>"; echo str_rot13($str2); // Numeric characters deosn't change echo "<br>"; echo str_rot13("Uryyb Rirelbar!!!"); echo "<br>"; echo str_rot13("Guvf vf 2020."); ?> </body> </html>