3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ ["ID" => "AAAA", "Name" => "Apple"], ["ID" => "BBBB", "Name" => "Avocado"], ["ID" => "CCCC", "Name" => "Banana"] ]; $array2 = [ [ "ID" => "AAAA", "Taste" => "Yumi", "Location" => "France", "Price" => "Cheap" ], [ "ID" => "CCCC", "Taste" => "Yumi", "Location" => "Africa", "Price" => "Cheap" ], [ "ID" => "BBBB", "Taste" => "Yumi", "Location" => "America", "Price" => "Expensive" ], [ "ID" => "HZGA", "Taste" => "Berk", "Location" => "Moon", "Price" => "Expensive" ] ]; $lookup = array_column($array2, null, 'ID'); foreach ($array1 as &$row) { $row += $lookup[$row['ID']] ?? []; } var_export($array1);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 126) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/RqPvc
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array1, !1 = $array2, !2 = $lookup, !3 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   36     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
   37     8      > FE_RESET_RW                                      $8      !0, ->16
          9    > > FE_FETCH_RW                                              $8, !3, ->16
   38    10    >   FETCH_DIM_R                                      ~9      !3, 'ID'
         11        FETCH_DIM_IS                                     ~10     !2, ~9
         12        COALESCE                                         ~11     ~10
         13        QM_ASSIGN                                        ~11     <array>
         14        ASSIGN_OP                                     1          !3, ~11
   37    15      > JMP                                                      ->9
         16    >   FE_FREE                                                  $8
   40    17        INIT_FCALL                                               'var_export'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.41 ms | 1005 KiB | 15 Q