随机截取数组


           // 开始 , 数组总数, 取多少个
1 $rand_key = arr_Rand(1,$strCount,$kcData['exam_number']); // 获得随机数组(数字 对应数组下标 获取新的随机后数组) 2 function arr_Rand($begin, $count, $limit){ 3 $rand_array = range($begin, $count); // 随机生成范围内的数 4 shuffle($rand_array); 5 return array_slice($rand_array, 0, $limit); //截取前$limit个 6 }

猜你喜欢

转载自www.cnblogs.com/G921123/p/10155914.html