str_rot13 – PHP String Functions

Syntax :

str_rot13 ( string );

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.

Note : Encoding and decoding are done by the same function, passing an encoded string as an argument will return the original version of string.

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 :
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:

Uv sebz ghgbevnyzvarf!
Hi from tutorialmines!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *