可用
代码审计记录
提示的代码:
<?php
$arr1 = [
["id"=>1,"type"=>"http","value"=>10],
["id"=>2,"type"=>"http","value"=>11],
["id"=>3,"type"=>"http","value"=>12],
["id"=>4,"type"=>"http","value"=>13],
["id"=>5,"type"=>"http","value"=>14],
["id"=>6,"type"=>"http","value"=>15],
];
$arr2 = [
["sub_id"=>11,"id"=>1,"type"=>"http","remark"=>"www1","user_name"=>"baidu1"],
["sub_id"=>12,"id"=>2,"type"=>"http","remark"=>"www2","user_name"=>"baidu2"],
["sub_id"=>13,"id"=>3,"type"=>"http","remark"=>"www3","user_name"=>"baidu3"],
["sub_id"=>14,"id"=>4,"type"=>"http","remark"=>"www4","user_name"=>"baidu4"],
["sub_id"=>15,"id"=>5,"type"=>"http","remark"=>"www5","user_name"=>"baidu5"],
["sub_id"=>16,"id"=>6,"type"=>"http","remark"=>"www6","user_name"=>"baidu6"],
];
foreach ($arr1 as &$item)
{
foreach ($arr2 as $v)
{
if(($v["id"]==$item["id"]) && ($v["type"]==$item["type"]))
{
$item["user_name"] = $v["user_name"];
$item["remark"] = $v["remark"];
}
}
}
var_dump($arr1);