__str__是什么函数_PHP str_shuffle()函数与示例

__str__是什么函数

PHP str_shuffle()函数 (PHP str_shuffle() Function)

str_shuffle() function is a string function and it is used to shuffle all characters randomly in the string.

str_shuffle()函数是一个字符串函数,用于随机地随机排列字符串中的所有字符。

When this function executes, all time it returns shuffles string with random characters (characters from the given string).

执行此函数时,所有时间都会返回带有随机字符(给定字符串中的字符)的混洗字符串。

Syntax:

句法:

    str_shuffle(string);

It accepts the string and returns shuffled string.

它接受字符串并返回改组后的字符串。

Examples:

例子:

    Input: 
    $str = "This is IncludeHelp"
    Output:
    str_shuffle($str) = "enHeIdcupll"
    str_shuffle($str) = "IcduneeplHl"

PHP code:

PHP代码:

<?php
	$str = "IncludeHelp";	
	//printing shuffled string some of the times
	echo (str_shuffle($str) . "\n");
	echo (str_shuffle($str) . "\n");
	echo (str_shuffle($str) . "\n");
	echo (str_shuffle($str) . "\n");
	echo (str_shuffle($str) . "\n");

	$str = "ABC 123 @!#~&*()";	
	//printing shuffled string some of the times
	echo (str_shuffle($str) . "\n");
	echo (str_shuffle($str) . "\n");
	echo (str_shuffle($str) . "\n");
	echo (str_shuffle($str) . "\n");
	echo (str_shuffle($str) . "\n");	
?>

Output

输出量

enHeIdcupll
IcduneeplHl
eenulHpcIld
enucIHepdll
ldIlceeupHn
2~B*()@# !3A1& C
 @C&(#)12*~!3BA 
@* &2CA( !~31#)B
 B!2C1~([email protected] A*)
&A ~3 (CB2!)@1*#


翻译自: https://www.includehelp.com/php/str_shuffle-function-with-example.aspx

__str__是什么函数

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值