3v4l.org

run code in 500+ PHP versions simultaneously
<?php $start = new DateTime('2018-12-31 00:00:00'); $interval = new DateInterval('P1M'); $recurrences = 5; $period = new DatePeriod($start, $interval, $recurrences); assert($recurrences === $period->recurrences, 'The recurrences should match.'); var_dump(array_map(function(DateTime $date) { return $date->format('Y-m-d'); }, iterator_to_array($period)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kUrfp
function name:  (null)
number of ops:  34
compiled vars:  !0 = $start, !1 = $interval, !2 = $recurrences, !3 = $period
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   NEW                                                  $4      'DateTime'
          1        SEND_VAL_EX                                                  '2018-12-31+00%3A00%3A00'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $4
    4     4        NEW                                                  $7      'DateInterval'
          5        SEND_VAL_EX                                                  'P1M'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $7
    5     8        ASSIGN                                                       !2, 5
    7     9        NEW                                                  $11     'DatePeriod'
         10        SEND_VAR_EX                                                  !0
         11        SEND_VAR_EX                                                  !1
         12        SEND_VAR_EX                                                  !2
         13        DO_FCALL                                          0          
         14        ASSIGN                                                       !3, $11
    9    15        ASSERT_CHECK                                                 
         16        INIT_FCALL                                                   'assert'
         17        FETCH_OBJ_R                                          ~14     !3, 'recurrences'
         18        IS_IDENTICAL                                         ~15     !2, ~14
         19        SEND_VAL                                                     ~15
         20        SEND_VAL                                                     'The+recurrences+should+match.'
         21        DO_ICALL                                                     
   11    22        INIT_FCALL                                                   'var_dump'
         23        INIT_FCALL                                                   'array_map'
         24        DECLARE_LAMBDA_FUNCTION                              ~17     [0]
   13    25        SEND_VAL                                                     ~17
         26        INIT_FCALL                                                   'iterator_to_array'
         27        SEND_VAR                                                     !3
         28        DO_ICALL                                             $18     
         29        SEND_VAR                                                     $18
   11    30        DO_ICALL                                             $19     
   13    31        SEND_VAR                                                     $19
   11    32        DO_ICALL                                                     
   13    33      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kUrfp
function name:  {closure:/in/kUrfp:11}
number of ops:  6
compiled vars:  !0 = $date
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
   12     1        INIT_METHOD_CALL                                             !0, 'format'
          2        SEND_VAL_EX                                                  'Y-m-d'
          3        DO_FCALL                                          0  $1      
          4      > RETURN                                                       $1
   13     5*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
115.03 ms | 498 KiB | 13 Q