c str_rot13()_PHP str_rot13()函数与示例

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()

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值