3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [2 => [0 => 41000, 1 => 31079], 3 => [0 => 42963, 1 => 41189]]; $arr2 = [2 => [0 => 40213, 1 => 42054], 3 => [0 => 42998, 1 => 34567]]; function addArray(&$bucket, $water) { foreach ($water as $key => $drop) { $bucket[$key] = array_merge($bucket[$key] ?? [], $drop); } } $combined = []; addArray($combined, $arr1); addArray($combined, $arr2); var_export($combined);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s4JXj
function name:  (null)
number of ops:  15
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $combined
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
   13     2        ASSIGN                                                   !2, <array>
   14     3        INIT_FCALL                                               'addarray'
          4        SEND_REF                                                 !2
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0          
   15     7        INIT_FCALL                                               'addarray'
          8        SEND_REF                                                 !2
          9        SEND_VAR                                                 !1
         10        DO_FCALL                                      0          
   17    11        INIT_FCALL                                               'var_export'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function addarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/s4JXj
function name:  addArray
number of ops:  17
compiled vars:  !0 = $bucket, !1 = $water, !2 = $drop, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2      > FE_RESET_R                                       $4      !1, ->15
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->15
          4    >   ASSIGN                                                   !3, ~5
    9     5        INIT_FCALL                                               'array_merge'
          6        FETCH_DIM_IS                                     ~8      !0, !3
          7        COALESCE                                         ~9      ~8
          8        QM_ASSIGN                                        ~9      <array>
          9        SEND_VAL                                                 ~9
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $10     
         12        ASSIGN_DIM                                               !0, !3
         13        OP_DATA                                                  $10
    8    14      > JMP                                                      ->3
         15    >   FE_FREE                                                  $4
   11    16      > RETURN                                                   null

End of function addarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
125.01 ms | 1004 KiB | 17 Q