我有一个变量$id = 10,需要在里面使用array_walk().如下:
$id = 10;
array_walk($profile_items, function(&$a) {
$count = $this->db->where('profile_item_id', $a['id'])->where('cover_type_id', $id)->count_all_results('cover_type_profile_items_link');
$a['selected'] = $id;
});
echo "<pre>";
print_r($profile_items).exit;
Run Code Online (Sandbox Code Playgroud)
当我在其中使用$id变量时array_walk()显示错误.
消息:未定义的变量:id
有解决方案吗
谢谢你的建议