3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getMonths($begin, $end) { $monthsData = array(); $dateBegin = new \DateTime($begin); $dateEnd = new \DateTime($end); while ($dateBegin->getTimestamp() < $dateEnd->getTimestamp()) { $monthsData[] = $dateBegin->format('m/Y'); $dateBegin->add(new \DateInterval('P1M')); } //ksort($monthsData); return $monthsData; } $monthsData = getMonths('2018-05-01', '2020-01-01' ); $grid = array(); foreach ($monthsData as $month) { $grid[$month]['montant'] = 0; } var_dump($grid[$month]);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/JeQIE
function name:  (null)
number of ops:  18
compiled vars:  !0 = $monthsData, !1 = $grid, !2 = $month
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'getmonths'
          1        SEND_VAL                                                 '2018-05-01'
          2        SEND_VAL                                                 '2020-01-01'
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !0, $3
   20     5        ASSIGN                                                   !1, <array>
   21     6      > FE_RESET_R                                       $6      !0, ->12
          7    > > FE_FETCH_R                                               $6, !2, ->12
   23     8    >   FETCH_DIM_W                                      $7      !1, !2
          9        ASSIGN_DIM                                               $7, 'montant'
         10        OP_DATA                                                  0
   21    11      > JMP                                                      ->7
         12    >   FE_FREE                                                  $6
   26    13        INIT_FCALL                                               'var_dump'
         14        FETCH_DIM_R                                      ~9      !1, !2
         15        SEND_VAL                                                 ~9
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function getmonths:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 12
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 12
Branch analysis from position: 29
Branch analysis from position: 12
filename:       /in/JeQIE
function name:  getMonths
number of ops:  31
compiled vars:  !0 = $begin, !1 = $end, !2 = $monthsData, !3 = $dateBegin, !4 = $dateEnd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ASSIGN                                                   !2, <array>
    7     3        NEW                                              $6      'DateTime'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !3, $6
    8     7        NEW                                              $9      'DateTime'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !4, $9
   10    11      > JMP                                                      ->23
   11    12    >   INIT_METHOD_CALL                                         !3, 'format'
         13        SEND_VAL_EX                                              'm%2FY'
         14        DO_FCALL                                      0  $13     
         15        ASSIGN_DIM                                               !2
         16        OP_DATA                                                  $13
   12    17        INIT_METHOD_CALL                                         !3, 'add'
         18        NEW                                              $14     'DateInterval'
         19        SEND_VAL_EX                                              'P1M'
         20        DO_FCALL                                      0          
         21        SEND_VAR_NO_REF_EX                                       $14
         22        DO_FCALL                                      0          
   10    23    >   INIT_METHOD_CALL                                         !3, 'getTimestamp'
         24        DO_FCALL                                      0  $17     
         25        INIT_METHOD_CALL                                         !4, 'getTimestamp'
         26        DO_FCALL                                      0  $18     
         27        IS_SMALLER                                               $17, $18
         28      > JMPNZ                                                    ~19, ->12
   16    29    > > RETURN                                                   !2
   17    30*     > RETURN                                                   null

End of function getmonths

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.89 ms | 1394 KiB | 16 Q