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' ) );$tmp = ''; foreach ($arr2 as $k) { $tmp[$k['id']] = $k; } foreach ($arr as &$v) { $sn = $tmp[$v['id']]['shop_name']; $sn = $sn ? $sn :''; $v['shop_name'] = $sn; }print_r($tmp); print_r($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
2 jumps found. (Code = 125) Position 1 = 11, Position 2 = 24
Branch analysis from position: 11
2 jumps found. (Code = 126) Position 1 = 12, Position 2 = 24
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 9
filename:       /in/HD6qO
function name:  (null)
number of ops:  32
compiled vars:  !0 = $arr, !1 = $arr2, !2 = $tmp, !3 = $k, !4 = $v, !5 = $sn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        ASSIGN                                                   !1, <array>
   30     2        ASSIGN                                                   !2, ''
   31     3      > FE_RESET_R                                       $9      !1, ->9
          4    > > FE_FETCH_R                                               $9, !3, ->9
          5    >   FETCH_DIM_R                                      ~10     !3, 'id'
          6        ASSIGN_DIM                                               !2, ~10
          7        OP_DATA                                                  !3
          8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $9
   32    10      > FE_RESET_RW                                      $12     !0, ->24
         11    > > FE_FETCH_RW                                              $12, !4, ->24
   33    12    >   FETCH_DIM_R                                      ~13     !4, 'id'
         13        FETCH_DIM_R                                      ~14     !2, ~13
         14        FETCH_DIM_R                                      ~15     ~14, 'shop_name'
         15        ASSIGN                                                   !5, ~15
   34    16      > JMPZ                                                     !5, ->19
         17    >   QM_ASSIGN                                        ~17     !5
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~17     ''
         20    >   ASSIGN                                                   !5, ~17
   35    21        ASSIGN_DIM                                               !4, 'shop_name'
         22        OP_DATA                                                  !5
   32    23      > JMP                                                      ->11
         24    >   FE_FREE                                                  $12
   36    25        INIT_FCALL                                               'print_r'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
   38    28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
207.95 ms | 1396 KiB | 15 Q