我有一个数组数组:
$students= array(
array("name"=>"...", "gender"=>"male"),
array("name"=>"...", "gender"=>"female"),
array("name"=>"...", "gender"=>"female"),
array("name"=>"...", "gender"=>"female"),
array("name"=>"...", "gender"=>"male"),
array("name"=>"...", "gender"=>"male"),
array("name"=>"...", "gender"=>"male"),
);
我想$students通过交替性别对元素进行排序以获得:
$students= array(
array("name"=>"...", "gender"=>"male"),
array("name"=>"...", "gender"=>"female"),
array("name"=>"...", "gender"=>"male"),
array("name"=>"...", "gender"=>"female"),
array("name"=>"...", "gender"=>"male"),
array("name"=>"...", "gender"=>"female"),
array("name"=>"...", "gender"=>"male"),
);
我怎样才能做到这一点?
繁花不似锦
慕运维8079593
胡子哥哥