PHP str_rot13() Function
In this chapter you will learn:
- Definition for PHP str_rot13() Function
- Syntax for PHP str_rot13() Function
- Parameter for PHP str_rot13() Function
- Return for PHP str_rot13() Function
- Note for PHP str_rot13() Function
- Example - Encode and decode a string
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:
/*from ja va2 s . c o m*/
<?php
echo str_rot13("java2s.com");
echo "\n";
echo str_rot13("Uryyb Jbeyq");
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP str_shuffle() Function
- Syntax for PHP str_shuffle() Function
- Parameter for PHP str_shuffle() Function
- Return for PHP str_shuffle() Function
- Example - Randomly shuffle all characters of a string
Home » PHP Tutorial » PHP String Functions