3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array1 = array( array('id' => 1, 'name' => 'John Doe', 'age' => 20), array('id' => 2, 'name' => 'Mae Doe', 'age' => 17), array('id' => 3, 'name' => 'Mark Smith', 'age' => 35), array('id' => 4, 'name' => 'Selena Smith', 'age' => 15), array('id' => 5, 'name' => 'Shane Doe', 'age' => 26), array('id' => 6, 'name' => 'Will Smith', 'age' => 45) ); $array2 = array( array('id' => 1, 'address' => 'Singapore', 'phone_number' => '123', 'store_name' => 'ABC'), array('id' => 4, 'address' => 'Japan', 'phone_number' => '456', 'store_name' => 'DEF'), array('id' => 5, 'address' => 'Korea', 'phone_number' => '789', 'store_name' => 'GHI') ); $addresses = array_column($array2, null, 'id'); foreach ($array1 as &$arr) { if (isset($addresses[$arr['id']])) $arr = array_merge($arr, $addresses[$arr['id']]); } print_r($array1);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 9, Position 2 = 21
Branch analysis from position: 9
2 jumps found. (Code = 126) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/TTToS
function name:  (null)
number of ops:  26
compiled vars:  !0 = $array1, !1 = $array2, !2 = $addresses, !3 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   12     1        ASSIGN                                                       !1, <array>
   18     2        INIT_FCALL                                                   'array_column'
          3        SEND_VAR                                                     !1
          4        SEND_VAL                                                     null
          5        SEND_VAL                                                     'id'
          6        DO_ICALL                                             $6      
          7        ASSIGN                                                       !2, $6
   19     8      > FE_RESET_RW                                          $8      !0, ->21
          9    > > FE_FETCH_RW                                                  $8, !3, ->21
   20    10    >   FETCH_DIM_R                                          ~9      !3, 'id'
         11        ISSET_ISEMPTY_DIM_OBJ                             0          !2, ~9
         12      > JMPZ                                                         ~10, ->20
         13    >   INIT_FCALL                                                   'array_merge'
         14        SEND_VAR                                                     !3
         15        FETCH_DIM_R                                          ~11     !3, 'id'
         16        FETCH_DIM_R                                          ~12     !2, ~11
         17        SEND_VAL                                                     ~12
         18        DO_ICALL                                             $13     
         19        ASSIGN                                                       !3, $13
   19    20    > > JMP                                                          ->9
         21    >   FE_FREE                                                      $8
   22    22        INIT_FCALL                                                   'print_r'
         23        SEND_VAR                                                     !0
         24        DO_ICALL                                                     
         25      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.98 ms | 2384 KiB | 16 Q