PHP performs ROT13 encoding function str_rot13() on strings

黄舟
Release: 2023-03-17 06:06:02
Original
2421 people have browsed it

Example

Encoding and decoding String:

<?php
echo str_rot13("Hello World");
echo "<br>";
echo str_rot13("Uryyb Jbeyq");
?>
Copy after login

Definition and usage

str_rot13() FunctionCharacter The string performs ROT13 encoding.

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

Tip: Encoding and decoding are both done by the same function. If you pass an encoded string as a parameter, the original string will be returned.

Syntax

str_rot13(string)
Copy after login
ParametersDescription
string Required. Specifies the string to be encoded.

Technical details

Return value: Returns a ROT13 encoded string.
PHP Version: 4.2.0+
Change Log:Prior to PHP 4.3, strings could be modified as if passed by reference.

Example

Encode and then decode the string:

<?php
echo str_rot13("I love Shanghai");
echo "<br>";
echo str_rot13("V ybir Funatunv");
?>
Copy after login

Result:

"; echo str_rot13("V ybir Funatunv"); ?>
Copy after login

The above is the detailed content of PHP performs ROT13 encoding function str_rot13() on strings. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!