PHP String str_rot13()函數(shù)
str_rot13()是內(nèi)置的PHP函數(shù)。愛掏網(wǎng) - it200.com它用于對(duì)字符串執(zhí)行ROT12編碼。愛掏網(wǎng) - it200.com
該函數(shù)將字母向字母表中的后面移動(dòng)13個(gè)位置,并保持?jǐn)?shù)字和非字母字符不變。愛掏網(wǎng) - it200.com
注意:該函數(shù)使用同一函數(shù)進(jìn)行編碼或解碼。愛掏網(wǎng) - it200.com
str_rot13(string);
參數(shù) | 描述 | 必需/可選 |
---|---|---|
string | 指定要進(jìn)行編碼的字符串 | 必需 |
示例1
<?php
str="Hello PHP";
echo "Before using str_rot13() function:".str;
echo "<br>";
echo "After using str_rot13() function:".str_rot13($str);
?>
輸出:
Before using str_rot13() function:Hello PHP
Before using str_rot13() function:Uryyb CUC
示例2
<?php
str="Uryyb CUC";
echo "Before using str_rot13() function:".str;
echo "<br>";
echo "After using str_rot13() function:".str_rot13($str);
?>
輸出:
Before using str_rot13() function:Uryyb CUC
After using str_rot13() function:Hello PHP
示例3
<?php
str1="Hello PHP";str2="Uryyb CUC";
str3=str_rot13(str2);
if(str1==str3){
echo "Both string is is Equall: "."str1"." = "."str3";
}
?>
輸出:
Both string is is Equall: Hello PHP = Hello PHP
參考:
http://php.net/manual/zh/function.str-rot13.php
聲明:所有內(nèi)容來自互聯(lián)網(wǎng)搜索結(jié)果,不保證100%準(zhǔn)確性,僅供參考。如若本站內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系我們進(jìn)行處理。