3v4l.org

run code in 500+ PHP versions simultaneously
<?php $data = [ 2022 => [ 'Jan' => 1, 'Mar' => 2, ] ]; $allMonths = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; foreach($data as $year => $months) { $total = 0; foreach($allMonths as $monthShort) { $monthCount = $months[$monthShort] ?? 0; $total += $monthCount; echo $monthCount, PHP_EOL; } echo 'Total:' . $total; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 20
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
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 = 3
Branch analysis from position: 3
Branch analysis from position: 16
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/ahHonY
function name:  (null)
number of ops:  22
compiled vars:  !0 = $data, !1 = $allMonths, !2 = $months, !3 = $year, !4 = $total, !5 = $monthShort, !6 = $monthCount
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   10     1        ASSIGN                                                       !1, <array>
   12     2      > FE_RESET_R                                           $9      !0, ->20
          3    > > FE_FETCH_R                                           ~10     $9, !2, ->20
          4    >   ASSIGN                                                       !3, ~10
   13     5        ASSIGN                                                       !4, 0
   14     6      > FE_RESET_R                                           $13     !1, ->16
          7    > > FE_FETCH_R                                                   $13, !5, ->16
   15     8    >   FETCH_DIM_IS                                         ~14     !2, !5
          9        COALESCE                                             ~15     ~14
         10        QM_ASSIGN                                            ~15     0
         11        ASSIGN                                                       !6, ~15
   16    12        ASSIGN_OP                                         1          !4, !6
   17    13        ECHO                                                         !6
         14        ECHO                                                         '%0A'
   14    15      > JMP                                                          ->7
         16    >   FE_FREE                                                      $13
   19    17        CONCAT                                               ~18     'Total%3A', !4
         18        ECHO                                                         ~18
   12    19      > JMP                                                          ->3
         20    >   FE_FREE                                                      $9
   20    21      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
199.14 ms | 1875 KiB | 13 Q