str_rot13 – PHP String Functions
Syntax :
Description :
str_rot13() function Perform the ROT13 transform/encoding and decoding on a string.
The ROT13 encoding simply shifts every letter by 13 places in the alphabet. It does not do any transformation for non-alpha characters. For e.g Numbers and non-alphabetical characters.
Parameter :
- string – This is a Required parameter. It is the input string which will be encoded.
Output :
This will return a ROT13 version of the encoded string.
str_rot13() – PHP Functions Example 1 :
<?php echo str_rot13("Hi from tutorialmines!"); echo "<br>"; echo str_rot13("Uv sebz ghgbevnyzvarf!"); ?>
In above example ,We have a string “Hi from tutorialmines!”. Now this function encode the string to “Uv sebz ghgbevnyzvarf!” and the 2nd string is “Uv sebz ghgbevnyzvarf!”. This will be decoded back to original text. Output of above code in the browser is as below:
Hi from tutorialmines!