做而当随机再次 - PHP的乱阵 [英] php random array - random again when doing while
本文介绍了做而当随机再次 - PHP的乱阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在,每一次我做了一段时间做的,它从上转到我的数组的底部。我怎样才能使它通过每个价值,但在随机模式,而不是从上到下?
Right now, every single time I do a while do, it goes from top to bottom of my array. How can I make it go through each value but in a random mode, not from top to bottom?
下面是我有:
$xbb = array('avotf1',
'avotf2',
'avotf3',
'avotf4',
'avotf5',
'avotf6',
'avotf7',
'avotf8',
'avotf9',
'avotf11',
'avotf12',
'avotf13',
'avotf14',
'avotf15',
'avotf10');
foreach($xbb as $item)
{
echo "$item<br>";
}
我如何洗牌的随机序列,我有,仍然显示所有15个值?
How do I shuffle the random array that I have and still show all 15 values?
推荐答案
使用 它洗洗牌()
:
shuffle($xbb);
搜索谷歌对于 PHP洗牌阵列会给你吨结果为好,顺便说一句。
Searching Google for php shuffle array will give you tons of results as well, by the way.
这篇关于做而当随机再次 - PHP的乱阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文