3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ [ 'id' => 1, 'name' => 'John', 'email' => 'j@mail.com' ], [ 'id' => 2, 'name' => 'Jane', 'email' => 'jane@mail.com' ] ]; $arr2 = [ [ 'id' => 1, 'email' => 'john@yahoo.com' ], [ 'id' => 2, 'email' => 'jane@yahoo.com' ], [ 'id' => 2, 'email' => 'jane.doe@hotmail.com' ], ]; foreach ($arr2 as ['id' => $id, 'email' => $lookup[$id][]]); foreach ($arr1 as ['id' => $id, 'email' => &$email]) { $email = array_merge((array) $email, $lookup[$id] ?? []); } var_export($arr1);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
2 jumps found. (Code = 125) Position 1 = 14, Position 2 = 31
Branch analysis from position: 14
2 jumps found. (Code = 126) Position 1 = 15, Position 2 = 31
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 12
filename:       /in/VOhp1
function name:  (null)
number of ops:  36
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $id, !3 = $lookup, !4 = $email
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   16     1        ASSIGN                                                   !1, <array>
   31     2      > FE_RESET_R                                       $7      !1, ->12
          3    > > FE_FETCH_R                                               $7, $8, ->12
          4    >   FETCH_LIST_R                                     $9      $8, 'id'
          5        ASSIGN                                                   !2, $9
          6        FETCH_LIST_R                                     $11     $8, 'email'
          7        FETCH_DIM_W                                      $12     !3, !2
          8        ASSIGN_DIM                                               $12
          9        OP_DATA                                                  $11
         10        FREE                                                     $8
         11      > JMP                                                      ->3
         12    >   FE_FREE                                                  $7
   33    13      > FE_RESET_RW                                      $14     !0, ->31
         14    > > FE_FETCH_RW                                              $14, $15, ->31
         15    >   FETCH_LIST_R                                     $16     $15, 'id'
         16        ASSIGN                                                   !2, $16
         17        FETCH_LIST_W                                     $18     $15, 'email'
         18        MAKE_REF                                         $19     $18
         19        ASSIGN_REF                                               !4, $19
         20        FREE                                                     $15
   34    21        INIT_FCALL                                               'array_merge'
         22        CAST                                          7  ~21     !4
         23        SEND_VAL                                                 ~21
         24        FETCH_DIM_IS                                     ~22     !3, !2
         25        COALESCE                                         ~23     ~22
         26        QM_ASSIGN                                        ~23     <array>
         27        SEND_VAL                                                 ~23
         28        DO_ICALL                                         $24     
         29        ASSIGN                                                   !4, $24
   33    30      > JMP                                                      ->14
         31    >   FE_FREE                                                  $14
   37    32        INIT_FCALL                                               'var_export'
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.88 ms | 1004 KiB | 15 Q