我有这个:
<?php $n = rand(1,1600); echo $n ?>
我想从随机数中排除 234、1578、763、1274 和其他数字。我该怎么做?
最佳答案
<?php
while( in_array( ($n = mt_rand(1,1600)), array(234, 1578 ,763 , 1274) ) );
关于PHP rand() 排除某些数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17109465/