3v4l.org

run code in 300+ PHP versions simultaneously
<?php $first = array ( 0 => array ( 'id' => 5, 'name' => 'Education' ), 1 => array ( 'id' => 4, 'name' => 'Computers' ), 3 => array ( 'id' => 7, 'name' => 'Science' ), 4 => array ( 'id' => 1, 'name' => 'Sports' ), ); $second = array ( 0 => array ( 'id' => 1, 'title' => 'Sport' ), 1 => array ( 'id' => 7, 'title' => 'Sci' ), 3 => array ( 'id' => 4, 'title' => 'Comp' ), 4 => array ( 'id' => 5, 'title' => 'Edu' ), ); $second = array_column($second, null, 'id'); foreach ($first as &$subject) { $subject += $second[$subject['id']] ?? []; } print_r($first);
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/Hbuc0
function name:  (null)
number of ops:  21
compiled vars:  !0 = $first, !1 = $second, !2 = $subject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   22     1        ASSIGN                                                   !1, <array>
   41     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 null
          5        SEND_VAL                                                 'id'
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !1, $5
   42     8      > FE_RESET_RW                                      $7      !0, ->16
          9    > > FE_FETCH_RW                                              $7, !2, ->16
   43    10    >   FETCH_DIM_R                                      ~8      !2, 'id'
         11        FETCH_DIM_IS                                     ~9      !1, ~8
         12        COALESCE                                         ~10     ~9
         13        QM_ASSIGN                                        ~10     <array>
         14        ASSIGN_OP                                     1          !2, ~10
   42    15      > JMP                                                      ->9
         16    >   FE_FREE                                                  $7
   45    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.4 ms | 998 KiB | 15 Q