代码示例:
$list = [
['name' => '小明','age' => 18],
['name' => '小李','age' => 0]
];
var_dump($list);
var_dump('===============================================================');
$result = [];
array_filter($list, function ($item) use (&$result) {
if ($item['age'] != 0) {
$result[] = $item;
}
});
var_dump($result);
代码示例运行结果: