3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array( 'id' => 1, 'user_name'=>'test1' ), array( 'id' => 2, 'user_name'=>'test2' ), array( 'id' => 3, 'user_name'=>'test3' ) ); $arr2 = array( array( 'id' => 1, 'shop_name'=>'shop1' ), array( 'id' => 5, 'shop_name'=>'shop2' ), array( 'id' => 3, 'shop_name'=>'shop3' ) ); foreach($arr as $key => &$value) { $value['shop_name']=''; } unset( $value ); foreach($arr as $k2 =>&$v2) { foreach($arr2 as $k =>$v) { if($v2['id'] == $v['id']) { $v2['shop_name'] = $v['shop_name']; } } } print_r($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
2 jumps found. (Code = 125) Position 1 = 11, Position 2 = 26
Branch analysis from position: 11
2 jumps found. (Code = 126) Position 1 = 12, Position 2 = 26
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 24
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 24
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 23
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 24
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 8
filename:       /in/QbkC2
function name:  (null)
number of ops:  31
compiled vars:  !0 = $arr, !1 = $arr2, !2 = $value, !3 = $key, !4 = $v2, !5 = $k2, !6 = $v, !7 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        ASSIGN                                                   !1, <array>
   32     2      > FE_RESET_RW                                      $10     !0, ->8
          3    > > FE_FETCH_RW                                      ~11     $10, !2, ->8
          4    >   ASSIGN                                                   !3, ~11
   33     5        ASSIGN_DIM                                               !2, 'shop_name'
          6        OP_DATA                                                  ''
   32     7      > JMP                                                      ->3
          8    >   FE_FREE                                                  $10
   35     9        UNSET_CV                                                 !2
   36    10      > FE_RESET_RW                                      $14     !0, ->26
         11    > > FE_FETCH_RW                                      ~15     $14, !4, ->26
         12    >   ASSIGN                                                   !5, ~15
   37    13      > FE_RESET_R                                       $17     !1, ->24
         14    > > FE_FETCH_R                                       ~18     $17, !6, ->24
         15    >   ASSIGN                                                   !7, ~18
   38    16        FETCH_DIM_R                                      ~20     !4, 'id'
         17        FETCH_DIM_R                                      ~21     !6, 'id'
         18        IS_EQUAL                                                 ~20, ~21
         19      > JMPZ                                                     ~22, ->23
   39    20    >   FETCH_DIM_R                                      ~24     !6, 'shop_name'
         21        ASSIGN_DIM                                               !4, 'shop_name'
         22        OP_DATA                                                  ~24
   37    23    > > JMP                                                      ->14
         24    >   FE_FREE                                                  $17
   36    25      > JMP                                                      ->11
         26    >   FE_FREE                                                  $14
   43    27        INIT_FCALL                                               'print_r'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.27 ms | 1400 KiB | 15 Q