Home > Backend Development > PHP Tutorial > 关于PHP随机分组的思路

关于PHP随机分组的思路

WBOY
Release: 2016-06-23 13:19:45
Original
1880 people have browsed it

初学PHP 
有个题目 班里有N个同学 想把他们随机分成M组 最后把组及组内成员打印出来 
怎么编比较好呢
注:学生有学号
谢谢大师们


回复讨论(解决方案)

把学生学号组成数组,shuffle() 打乱数组,然后array_chunk() 分组。

如楼上版主所说 

好的 谢谢 我先试试

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template