标签:style ar sp on c line ef r bs
$apple=array(‘apple1‘,‘apple2‘,‘apple3‘,‘apple4‘,‘apple5‘,‘apple6‘,‘apple7‘,‘apple8‘,‘apple9‘,‘apple10‘,‘apple11‘,‘apple12‘,‘apple13‘,‘apple14‘);
$children=array(‘chilren1‘,‘chilren2‘,‘chilren3‘,‘chilren4‘,‘chilren5‘,‘chilren6‘);
$i=0;
$chilren_count=count($children);
$count=count($apple);
while($count>0){
$index=mt_rand(0,count($apple)-1);
$tem=$apple[$index];
$fenpei[$children[$i]][]=$tem;
unset($apple[$index]);
$apple=array_values($apple);
$count=count($apple);
$i++;
if($i>$chilren_count-1){
$i=0;
}
}
print_r($fenpei);
标签:style ar sp on c line ef r bs
原文地址:http://www.cnblogs.com/zhuyibo/p/3984889.html