可用
代码审计记录
提示的代码:
01 | <?php |
02 | $arr1 = [ |
03 | [ "id" =>1, "type" => "http" , "value" =>10], |
04 | [ "id" =>2, "type" => "http" , "value" =>11], |
05 | [ "id" =>3, "type" => "http" , "value" =>12], |
06 | [ "id" =>4, "type" => "http" , "value" =>13], |
07 | [ "id" =>5, "type" => "http" , "value" =>14], |
08 | [ "id" =>6, "type" => "http" , "value" =>15], |
09 | ]; |
10 |
11 | $arr2 = [ |
12 | [ "sub_id" =>11, "id" =>1, "type" => "http" , "remark" => "www1" , "user_name" => "baidu1" ], |
13 | [ "sub_id" =>12, "id" =>2, "type" => "http" , "remark" => "www2" , "user_name" => "baidu2" ], |
14 | [ "sub_id" =>13, "id" =>3, "type" => "http" , "remark" => "www3" , "user_name" => "baidu3" ], |
15 | [ "sub_id" =>14, "id" =>4, "type" => "http" , "remark" => "www4" , "user_name" => "baidu4" ], |
16 | [ "sub_id" =>15, "id" =>5, "type" => "http" , "remark" => "www5" , "user_name" => "baidu5" ], |
17 | [ "sub_id" =>16, "id" =>6, "type" => "http" , "remark" => "www6" , "user_name" => "baidu6" ], |
18 | ]; |
19 |
20 | foreach ( $arr1 as & $item ) |
21 | { |
22 | foreach ( $arr2 as $v ) |
23 | { |
24 | if (( $v [ "id" ]== $item [ "id" ]) && ( $v [ "type" ]== $item [ "type" ])) |
25 | { |
26 | $item [ "user_name" ] = $v [ "user_name" ]; |
27 | $item [ "remark" ] = $v [ "remark" ]; |
28 | } |
29 | } |
30 | } |
31 |
32 | var_dump( $arr1 ); |
0则评论给“一个可变换的php的bug点”