3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! $wineBuys = array ( '2013-09-12' => 20, '2013-09-13' => 10, '2013-09-14' => 49 ); $hamBuys = array ( '2013-09-12' => 1, '2013-09-13' => 16, '2013-09-14' => 2 ); $cheeseBuys = array ( '2013-09-12' => 5, '2013-09-13' => 6, '2013-09-14' => 12 ); $calcByDate = array(); foreach ($wineBuys as $key => $value) { if (! array_key_exists($key, $calcByDate)) { $calcByDate[$key] = array($wineBuys[$key]); } else { $calcByDate[$key][] = $wineBuys[$key]; } } foreach ($hamBuys as $key => $value) { if (! array_key_exists($key, $calcByDate)) { $calcByDate[$key] = array($hamBuys[$key]); } else { $calcByDate[$key][] = $hamBuys[$key]; } } foreach ($cheeseBuys as $key => $value) { if (! array_key_exists($key, $calcByDate)) { $calcByDate[$key] = array($cheeseBuys[$key]); } else { $calcByDate[$key][] = $cheeseBuys[$key]; } } print_r($calcByDate); $test = array_merge_recursive($wineBuys, $hamBuys, $cheeseBuys); print_r($test);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 37
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 37
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 37
2 jumps found. (Code = 77) Position 1 = 39, Position 2 = 54
Branch analysis from position: 39
2 jumps found. (Code = 78) Position 1 = 40, Position 2 = 54
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 49
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
Branch analysis from position: 37
Branch analysis from position: 20
filename:       /in/U0NO4
function name:  (null)
number of ops:  68
compiled vars:  !0 = $wineBuys, !1 = $hamBuys, !2 = $cheeseBuys, !3 = $calcByDate, !4 = $value, !5 = $key, !6 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   15     2        ASSIGN                                                   !2, <array>
   21     3        ASSIGN                                                   !3, <array>
   23     4      > FE_RESET_R                                       $11     !0, ->20
          5    > > FE_FETCH_R                                       ~12     $11, !4, ->20
          6    >   ASSIGN                                                   !5, ~12
   24     7        ARRAY_KEY_EXISTS                                 ~14     !5, !3
          8        BOOL_NOT                                         ~15     ~14
          9      > JMPZ                                                     ~15, ->15
   25    10    >   FETCH_DIM_R                                      ~17     !0, !5
         11        INIT_ARRAY                                       ~18     ~17
         12        ASSIGN_DIM                                               !3, !5
         13        OP_DATA                                                  ~18
         14      > JMP                                                      ->19
   28    15    >   FETCH_DIM_R                                      ~21     !0, !5
         16        FETCH_DIM_W                                      $19     !3, !5
         17        ASSIGN_DIM                                               $19
         18        OP_DATA                                                  ~21
   23    19    > > JMP                                                      ->5
         20    >   FE_FREE                                                  $11
   32    21      > FE_RESET_R                                       $22     !1, ->37
         22    > > FE_FETCH_R                                       ~23     $22, !4, ->37
         23    >   ASSIGN                                                   !5, ~23
   33    24        ARRAY_KEY_EXISTS                                 ~25     !5, !3
         25        BOOL_NOT                                         ~26     ~25
         26      > JMPZ                                                     ~26, ->32
   34    27    >   FETCH_DIM_R                                      ~28     !1, !5
         28        INIT_ARRAY                                       ~29     ~28
         29        ASSIGN_DIM                                               !3, !5
         30        OP_DATA                                                  ~29
         31      > JMP                                                      ->36
   37    32    >   FETCH_DIM_R                                      ~32     !1, !5
         33        FETCH_DIM_W                                      $30     !3, !5
         34        ASSIGN_DIM                                               $30
         35        OP_DATA                                                  ~32
   32    36    > > JMP                                                      ->22
         37    >   FE_FREE                                                  $22
   41    38      > FE_RESET_R                                       $33     !2, ->54
         39    > > FE_FETCH_R                                       ~34     $33, !4, ->54
         40    >   ASSIGN                                                   !5, ~34
   42    41        ARRAY_KEY_EXISTS                                 ~36     !5, !3
         42        BOOL_NOT                                         ~37     ~36
         43      > JMPZ                                                     ~37, ->49
   43    44    >   FETCH_DIM_R                                      ~39     !2, !5
         45        INIT_ARRAY                                       ~40     ~39
         46        ASSIGN_DIM                                               !3, !5
         47        OP_DATA                                                  ~40
         48      > JMP                                                      ->53
   46    49    >   FETCH_DIM_R                                      ~43     !2, !5
         50        FETCH_DIM_W                                      $41     !3, !5
         51        ASSIGN_DIM                                               $41
         52        OP_DATA                                                  ~43
   41    53    > > JMP                                                      ->39
         54    >   FE_FREE                                                  $33
   50    55        INIT_FCALL                                               'print_r'
         56        SEND_VAR                                                 !3
         57        DO_ICALL                                                 
   54    58        INIT_FCALL                                               'array_merge_recursive'
         59        SEND_VAR                                                 !0
         60        SEND_VAR                                                 !1
         61        SEND_VAR                                                 !2
         62        DO_ICALL                                         $45     
         63        ASSIGN                                                   !6, $45
   57    64        INIT_FCALL                                               'print_r'
         65        SEND_VAR                                                 !6
         66        DO_ICALL                                                 
         67      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.68 ms | 1400 KiB | 17 Q