3v4l.org

run code in 300+ PHP versions simultaneously
<?php $firstAvailableCount = 100; $slice = 'monthly'; $countData = array(); $startDateTime = new DateTime("2016-01-01"); $endDateTime = new DateTime("2016-02-02"); fillCountMapPeriod($startDateTime,$endDateTime,$countData,$firstAvailableCount,$slice); function fillCountMapPeriod( DateTime $startDateTime, DateTime $endDateTime, array $countData, $firstAvailableCount, $slice) { if($slice == 'monthly') { $interval = new DateInterval('P1M'); $format = 'm-Y'; } else { $interval = new DateInterval('P1W'); $format = 'W-Y'; } if($startDateTime->format($format) == $endDateTime->format($format)) { var_dump($startDateTime->format($format)); return; } $endDateTime->add($interval); var_dump($endDateTime); while($startDateTime <= $endDateTime){ var_dump($startDateTime->format("d-".$format)); $startDateTime->add($interval); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P7Ded
function name:  (null)
number of ops:  19
compiled vars:  !0 = $firstAvailableCount, !1 = $slice, !2 = $countData, !3 = $startDateTime, !4 = $endDateTime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 100
    4     1        ASSIGN                                                   !1, 'monthly'
    5     2        ASSIGN                                                   !2, <array>
    7     3        NEW                                              $8      'DateTime'
          4        SEND_VAL_EX                                              '2016-01-01'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !3, $8
    8     7        NEW                                              $11     'DateTime'
          8        SEND_VAL_EX                                              '2016-02-02'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !4, $11
   10    11        INIT_FCALL_BY_NAME                                       'fillCountMapPeriod'
         12        SEND_VAR_EX                                              !3
         13        SEND_VAR_EX                                              !4
         14        SEND_VAR_EX                                              !2
         15        SEND_VAR_EX                                              !0
         16        SEND_VAR_EX                                              !1
         17        DO_FCALL                                      0          
   32    18      > RETURN                                                   1

Function fillcountmapperiod:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 33
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 52, Position 2 = 40
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 52, Position 2 = 40
Branch analysis from position: 52
Branch analysis from position: 40
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 33
Branch analysis from position: 26
Branch analysis from position: 33
filename:       /in/P7Ded
function name:  fillCountMapPeriod
number of ops:  53
compiled vars:  !0 = $startDateTime, !1 = $endDateTime, !2 = $countData, !3 = $firstAvailableCount, !4 = $slice, !5 = $interval, !6 = $format
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
   14     5        IS_EQUAL                                                 !4, 'monthly'
          6      > JMPZ                                                     ~7, ->13
   15     7    >   NEW                                              $8      'DateInterval'
          8        SEND_VAL_EX                                              'P1M'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !5, $8
   16    11        ASSIGN                                                   !6, 'm-Y'
         12      > JMP                                                      ->18
   18    13    >   NEW                                              $12     'DateInterval'
         14        SEND_VAL_EX                                              'P1W'
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !5, $12
   19    17        ASSIGN                                                   !6, 'W-Y'
   22    18    >   INIT_METHOD_CALL                                         !0, 'format'
         19        SEND_VAR_EX                                              !6
         20        DO_FCALL                                      0  $16     
         21        INIT_METHOD_CALL                                         !1, 'format'
         22        SEND_VAR_EX                                              !6
         23        DO_FCALL                                      0  $17     
         24        IS_EQUAL                                                 $16, $17
         25      > JMPZ                                                     ~18, ->33
   23    26    >   INIT_FCALL                                               'var_dump'
         27        INIT_METHOD_CALL                                         !0, 'format'
         28        SEND_VAR_EX                                              !6
         29        DO_FCALL                                      0  $19     
         30        SEND_VAR                                                 $19
         31        DO_ICALL                                                 
   24    32      > RETURN                                                   null
   26    33    >   INIT_METHOD_CALL                                         !1, 'add'
         34        SEND_VAR_EX                                              !5
         35        DO_FCALL                                      0          
   27    36        INIT_FCALL                                               'var_dump'
         37        SEND_VAR                                                 !1
         38        DO_ICALL                                                 
   28    39      > JMP                                                      ->50
   29    40    >   INIT_FCALL                                               'var_dump'
         41        INIT_METHOD_CALL                                         !0, 'format'
         42        CONCAT                                           ~23     'd-', !6
         43        SEND_VAL_EX                                              ~23
         44        DO_FCALL                                      0  $24     
         45        SEND_VAR                                                 $24
         46        DO_ICALL                                                 
   30    47        INIT_METHOD_CALL                                         !0, 'add'
         48        SEND_VAR_EX                                              !5
         49        DO_FCALL                                      0          
   28    50    >   IS_SMALLER_OR_EQUAL                                      !0, !1
         51      > JMPNZ                                                    ~27, ->40
   32    52    > > RETURN                                                   null

End of function fillcountmapperiod

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
190.4 ms | 1400 KiB | 15 Q