3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ [10, 'Some Name..'], [11, 'Some Name..'], [13, 'Some Name..'], ]; $array2 = [ [13, 'Viewed'] ]; $result = []; foreach (array_merge($array1, $array2) as [$id, $value]) { $result[$id][0] = $id; $result[$id][] = $value; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 21
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 21
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/OMfRa
function name:  (null)
number of ops:  26
compiled vars:  !0 = $array1, !1 = $array2, !2 = $result, !3 = $id, !4 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   13     2        ASSIGN                                                   !2, <array>
   14     3        INIT_FCALL                                               'array_merge'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $8      
          7      > FE_RESET_R                                       $9      $8, ->21
          8    > > FE_FETCH_R                                               $9, $10, ->21
          9    >   FETCH_LIST_R                                     $11     $10, 0
         10        ASSIGN                                                   !3, $11
         11        FETCH_LIST_R                                     $13     $10, 1
         12        ASSIGN                                                   !4, $13
         13        FREE                                                     $10
   15    14        FETCH_DIM_W                                      $15     !2, !3
         15        ASSIGN_DIM                                               $15, 0
         16        OP_DATA                                                  !3
   16    17        FETCH_DIM_W                                      $17     !2, !3
         18        ASSIGN_DIM                                               $17
         19        OP_DATA                                                  !4
   14    20      > JMP                                                      ->8
         21    >   FE_FREE                                                  $9
   19    22        INIT_FCALL                                               'var_export'
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.08 ms | 1011 KiB | 15 Q