c str_rot13()
PHP str_rot13()函数 (PHP str_rot13() Function )
str_rot13() function is a string function, it is used to encode (or decode the encoded string) a string using ROT13 encoding technique.
str_rot13()函数是一个字符串函数,用于使用ROT13编码技术对字符串进行编码(或解码)。
ROT13 encoding technique is used to encode only alphabets it does not encode the numbers, and other special characters. In ROT13 encoding technique each alphabet shift 13 place in the alphabet table.
ROT13编码技术仅用于编码字母,不编码数字和其他特殊字符。 在ROT13编码技术中,每个字母移位13在字母表中都处于位置。
Syntax:
句法:
str_rot13(string);
It accepts the string and returns the encoded string by ROT13 encoding technique
它接受字符串并通过ROT13编码技术返回编码的字符串
Examples:
例子:
Input: "This is IncludeHelp"
Output: "Guvf vf VapyhqrUryc"
Input: "Guvf vf VapyhqrUryc"
Output: "This is IncludeHelp"
Input: "Hello 123 %$#@!"
Output: :Uryyb 123 %$#@!"
PHP code:
PHP代码:
<?php
$str = "This is IncludeHelp";
$enc_str = str_rot13($str);
echo ("String = $str \n");
echo ("Encoded string = $enc_str \n");
//Here, we will convert encoded string
//that will be main string
$str = $enc_str;
$enc_str = str_rot13($str);
echo ("String = $str \n");
echo ("Encoded string = $enc_str \n");
//string with numbers & alphabets
$str = "Hello 123 %$#@!";
$enc_str = str_rot13($str);
echo ("String = $str \n");
echo ("Encoded string = $enc_str \n");
?>
Output
输出量
String = This is IncludeHelp
Encoded string = Guvf vf VapyhqrUryc
String = Guvf vf VapyhqrUryc
Encoded string = This is IncludeHelp
String = Hello 123 %$#@!
Encoded string = Uryyb 123 %$#@!
翻译自: https://www.includehelp.com/php/str_rot13-function-with-example.aspx
c str_rot13()