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) {$v2['shop_name']=''; 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 = 6
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 6
2 jumps found. (Code = 125) Position 1 = 9, Position 2 = 26
Branch analysis from position: 9
2 jumps found. (Code = 126) Position 1 = 10, Position 2 = 26
Branch analysis from position: 10
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 = 9
Branch analysis from position: 9
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: 6
filename:       /in/g9bam
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, ->6
          3    > > FE_FETCH_RW                                      ~11     $10, !2, ->6
          4    >   ASSIGN                                                   !3, ~11
          5      > JMP                                                      ->3
          6    >   FE_FREE                                                  $10
   35     7        UNSET_CV                                                 !2
   36     8      > FE_RESET_RW                                      $13     !0, ->26
          9    > > FE_FETCH_RW                                      ~14     $13, !4, ->26
         10    >   ASSIGN                                                   !5, ~14
         11        ASSIGN_DIM                                               !4, 'shop_name'
         12        OP_DATA                                                  ''
   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                                                      ->9
         26    >   FE_FREE                                                  $13
   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:
156.6 ms | 1400 KiB | 15 Q