时间:2021-07-01 10:21:17 帮助过:28人阅读
$arr = array(array(1,0),array(2,0),array(3,0),array(4,0),array(5,1),array(6,1),array(7,5),array(8,2)); print_r(foo($arr)); function foo($ar, $p=0) { $r = array(); foreach($ar as $v) { if($v[1] == $p) { $r[] = $v; $r = array_merge($r, foo($ar, $v[0])); } } return $r; }