3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ 310 => 0, 311 => 0, 312 => 0, 313 => 0, 314 => 0, 315 => 0 ]; $array2 = [ "2019-05-17" => [ 312 => 3000.00 ], "2019-06-20" => [ 312 => 3000.00 ], "2019-06-27" => [ 313 => 5000.00, 315 => 3000.00 ] ]; $merged = []; foreach($array2 as $date => $row) { foreach ($array1 as $id => $value) { $merged[$date][$id] = $row[$id] ?? $value; } } var_export($merged);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/tjLg4
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array1, !1 = $array2, !2 = $merged, !3 = $row, !4 = $date, !5 = $value, !6 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   25     2        ASSIGN                                                   !2, <array>
   26     3      > FE_RESET_R                                       $10     !1, ->18
          4    > > FE_FETCH_R                                       ~11     $10, !3, ->18
          5    >   ASSIGN                                                   !4, ~11
   27     6      > FE_RESET_R                                       $13     !0, ->16
          7    > > FE_FETCH_R                                       ~14     $13, !5, ->16
          8    >   ASSIGN                                                   !6, ~14
   28     9        FETCH_DIM_IS                                     ~18     !3, !6
         10        COALESCE                                         ~19     ~18
         11        QM_ASSIGN                                        ~19     !5
         12        FETCH_DIM_W                                      $16     !2, !4
         13        ASSIGN_DIM                                               $16, !6
         14        OP_DATA                                                  ~19
   27    15      > JMP                                                      ->7
         16    >   FE_FREE                                                  $13
   26    17      > JMP                                                      ->4
         18    >   FE_FREE                                                  $10
   31    19        INIT_FCALL                                               'var_export'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
127.95 ms | 1010 KiB | 14 Q