PHP performs ROT13 encoded function str_rot13 () on a string

Source: Internet
Author: User

Instance

Encode and decode the string:

<?phpecho str_rot13 ("Hello World"), echo "<br>", Echo str_rot13 ("Uryyb jbeyq"); >

Definition and usage

The str_rot13 () function performs ROT13 encoding on the string.

ROT13 encoding is to get each letter in the alphabet by moving forward 13 letters. Numeric and non-alphabetic characters remain unchanged.

Tip: Both encoding and decoding are done by the same function. If you take an encoded string as an argument, the original string is returned.

Grammar

STR_ROT13 (String)
Parameters Describe
String Necessary. Specifies the string to encode.

Technical details

return value: Returns a ROT13 encoded string.
PHP version: 4.2.0+
Update log: Before PHP 4.3, a string could be modified, as if it were passed by reference.

Instance

Encode and then decode the string:

<?phpecho str_rot13 ("I Love Shanghai"), echo "<br>", Echo str_rot13 ("V ybir FUNATUNV"); >

Results:

"; Echo str_rot13 ("V ybir FUNATUNV");?>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.