PHP str_rot13() Function
Definition
The str_rot13() function performs the ROT13 encoding on a string.
Syntax
PHP str_rot13() Function has the following syntax.
str_rot13(string)
Parameter
Parameter | IS Required | Description |
---|---|---|
string | Required. | String to encode |
Return
PHP str_rot13() Function returns the ROT13 version of the encoded string
Note
The ROT13 encoding shifts every letter 13 places in the alphabet. Numeric and non-alphabetical characters remains untouched.
Encoding and decoding are done by the same str_rot13() function. If you pass an encoded string, the original string is returned.
Example
Encode and decode a string:
/* w ww. ja v a 2 s . c o m*/
<?php
echo str_rot13("java2s.com");
echo "\n";
echo str_rot13("Uryyb Jbeyq");
?>
The code above generates the following result.