我必须从1到3得到三个随机数,结果中没有重复值:
$ total ='3';
$ rand1 = rand(1,$ total);
$ rand2 = rand(1,$ total);
$ rand3 = rand(1,$ total);
结果如下:1.2.3或3.2.1,或2.1.3
请提前帮助我,谢谢
如何改变阵列,如下:
$num = range(1,$total);
shuffle($num);
print_r($num);
Run Code Online (Sandbox Code Playgroud)