时间:2021-07-01 10:21:17 帮助过:5人阅读
$a = array(应该看得懂吧
Array ( 'tag' => 'id', 'type' => 'complete', 'level' => 4, 'value' => '01' ),
Array ( 'tag' => 'name', 'type' => 'complete', 'level' => 4, 'value' => '小张' ),
Array ( 'tag' => 'flag', 'type' => 'complete', 'level' => 4, ),
Array ( 'tag' => 'id', 'type' => 'complete', 'level' => 4, 'value' => '02' ),
Array ( 'tag' => 'name', 'type' => 'complete', 'level' => 4, 'value' => '小李' ),
Array ( 'tag' => 'flag', 'type' => 'complete', 'level' => 4, ),
Array ( 'tag' => 'id', 'type' => 'complete', 'level' => 4, 'value' => '03' ),
Array ( 'tag' => 'name', 'type' => 'complete', 'level' => 4, 'value' => '小刘' ),
Array ( 'tag' => 'flag', 'type' => 'complete', 'level' => 4, ),
);
$st = array();
foreach($a as $t) {
if(isset($st[$t['tag']])) {
//完成你需要的操作
$st = array();
}
$st[$t['tag']] = $t;
}