3v4l.org

run code in 500+ PHP versions simultaneously
<?php $start = new DateTimeImmutable('2012-07-01'); $end = new DateTimeImmutable('2012-07-31'); $interval = new DateInterval('P7D'); $recurrences = 4; $periodWithRecurrences = new DatePeriod($start, $interval, $recurrences); echo "With recurrences:\n"; foreach ($periodWithRecurrences as $r) { printf("start=%s\n", $periodWithRecurrences->start->format("Y-m-d H:i:s")); printf("current=%s\n", $periodWithRecurrences->current->format("Y-m-d H:i:s")); printf("end=%s\n", $periodWithRecurrences->end ? $periodWithRecurrences->end->format("Y-m-d H:i:s") : "null"); printf("interval=%s\n", $periodWithRecurrences->interval->format("P%r%yY%mM%dDT%hH%iM%sS (%ad)")); printf("recurrences=%s\n", $periodWithRecurrences->recurrences); printf("include_start_date=%s\n", $periodWithRecurrences->include_start_date); break; } $periodWithoutRecurrences = new DatePeriod($start, $interval, $end); echo "\nWithout recurrences:\n"; foreach ($periodWithoutRecurrences as $r) { printf("start=%s\n", $periodWithoutRecurrences->start->format("Y-m-d H:i:s")); printf("current=%s\n", $periodWithoutRecurrences->current->format("Y-m-d H:i:s")); printf("end=%s\n", $periodWithoutRecurrences->end ? $periodWithoutRecurrences->end->format("Y-m-d H:i:s") : "null"); printf("interval=%s\n", $periodWithoutRecurrences->interval->format("P%r%yY%mM%dDT%hH%iM%sS (%ad)")); printf("recurrences=%s\n", $periodWithoutRecurrences->recurrences); printf("include_start_date=%s\n", $periodWithoutRecurrences->include_start_date); break; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 71
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 71
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 48
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
2 jumps found. (Code = 77) Position 1 = 80, Position 2 = 130
Branch analysis from position: 80
2 jumps found. (Code = 78) Position 1 = 81, Position 2 = 130
Branch analysis from position: 81
2 jumps found. (Code = 43) Position 1 = 101, Position 2 = 107
Branch analysis from position: 101
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
1 jumps found. (Code = 42) Position 1 = 130
Branch analysis from position: 130
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 107
1 jumps found. (Code = 42) Position 1 = 130
Branch analysis from position: 130
Branch analysis from position: 130
Branch analysis from position: 130
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
Branch analysis from position: 71
Branch analysis from position: 71
filename:       /in/iGAV1
function name:  (null)
number of ops:  132
compiled vars:  !0 = $start, !1 = $end, !2 = $interval, !3 = $recurrences, !4 = $periodWithRecurrences, !5 = $r, !6 = $periodWithoutRecurrences
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   NEW                                                  $7      'DateTimeImmutable'
          1        SEND_VAL_EX                                                  '2012-07-01'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $7
    4     4        NEW                                                  $10     'DateTimeImmutable'
          5        SEND_VAL_EX                                                  '2012-07-31'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $10
    5     8        NEW                                                  $13     'DateInterval'
          9        SEND_VAL_EX                                                  'P7D'
         10        DO_FCALL                                          0          
         11        ASSIGN                                                       !2, $13
    6    12        ASSIGN                                                       !3, 4
    8    13        NEW                                                  $17     'DatePeriod'
         14        SEND_VAR_EX                                                  !0
         15        SEND_VAR_EX                                                  !2
         16        SEND_VAR_EX                                                  !3
         17        DO_FCALL                                          0          
         18        ASSIGN                                                       !4, $17
   10    19        ECHO                                                         'With+recurrences%3A%0A'
   11    20      > FE_RESET_R                                           $20     !4, ->71
         21    > > FE_FETCH_R                                                   $20, !5, ->71
   12    22    >   INIT_FCALL                                                   'printf'
         23        SEND_VAL                                                     'start%3D%25s%0A'
         24        FETCH_OBJ_R                                          ~21     !4, 'start'
         25        INIT_METHOD_CALL                                             ~21, 'format'
         26        SEND_VAL_EX                                                  'Y-m-d+H%3Ai%3As'
         27        DO_FCALL                                          0  $22     
         28        SEND_VAR                                                     $22
         29        DO_ICALL                                                     
   13    30        INIT_FCALL                                                   'printf'
         31        SEND_VAL                                                     'current%3D%25s%0A'
         32        FETCH_OBJ_R                                          ~24     !4, 'current'
         33        INIT_METHOD_CALL                                             ~24, 'format'
         34        SEND_VAL_EX                                                  'Y-m-d+H%3Ai%3As'
         35        DO_FCALL                                          0  $25     
         36        SEND_VAR                                                     $25
         37        DO_ICALL                                                     
   14    38        INIT_FCALL                                                   'printf'
         39        SEND_VAL                                                     'end%3D%25s%0A'
         40        FETCH_OBJ_R                                          ~27     !4, 'end'
         41      > JMPZ                                                         ~27, ->48
         42    >   FETCH_OBJ_R                                          ~28     !4, 'end'
         43        INIT_METHOD_CALL                                             ~28, 'format'
         44        SEND_VAL_EX                                                  'Y-m-d+H%3Ai%3As'
         45        DO_FCALL                                          0  $29     
         46        QM_ASSIGN                                            ~30     $29
         47      > JMP                                                          ->49
         48    >   QM_ASSIGN                                            ~30     'null'
         49    >   SEND_VAL                                                     ~30
         50        DO_ICALL                                                     
   15    51        INIT_FCALL                                                   'printf'
         52        SEND_VAL                                                     'interval%3D%25s%0A'
         53        FETCH_OBJ_R                                          ~32     !4, 'interval'
         54        INIT_METHOD_CALL                                             ~32, 'format'
         55        SEND_VAL_EX                                                  'P%25r%25yY%25mM%25dDT%25hH%25iM%25sS+%28%25ad%29'
         56        DO_FCALL                                          0  $33     
         57        SEND_VAR                                                     $33
         58        DO_ICALL                                                     
   16    59        INIT_FCALL                                                   'printf'
         60        SEND_VAL                                                     'recurrences%3D%25s%0A'
         61        FETCH_OBJ_R                                          ~35     !4, 'recurrences'
         62        SEND_VAL                                                     ~35
         63        DO_ICALL                                                     
   17    64        INIT_FCALL                                                   'printf'
         65        SEND_VAL                                                     'include_start_date%3D%25s%0A'
         66        FETCH_OBJ_R                                          ~37     !4, 'include_start_date'
         67        SEND_VAL                                                     ~37
         68        DO_ICALL                                                     
   18    69      > JMP                                                          ->71
   11    70*       JMP                                                          ->21
         71    >   FE_FREE                                                      $20
   21    72        NEW                                                  $39     'DatePeriod'
         73        SEND_VAR_EX                                                  !0
         74        SEND_VAR_EX                                                  !2
         75        SEND_VAR_EX                                                  !1
         76        DO_FCALL                                          0          
         77        ASSIGN                                                       !6, $39
   22    78        ECHO                                                         '%0AWithout+recurrences%3A%0A'
   23    79      > FE_RESET_R                                           $42     !6, ->130
         80    > > FE_FETCH_R                                                   $42, !5, ->130
   24    81    >   INIT_FCALL                                                   'printf'
         82        SEND_VAL                                                     'start%3D%25s%0A'
         83        FETCH_OBJ_R                                          ~43     !6, 'start'
         84        INIT_METHOD_CALL                                             ~43, 'format'
         85        SEND_VAL_EX                                                  'Y-m-d+H%3Ai%3As'
         86        DO_FCALL                                          0  $44     
         87        SEND_VAR                                                     $44
         88        DO_ICALL                                                     
   25    89        INIT_FCALL                                                   'printf'
         90        SEND_VAL                                                     'current%3D%25s%0A'
         91        FETCH_OBJ_R                                          ~46     !6, 'current'
         92        INIT_METHOD_CALL                                             ~46, 'format'
         93        SEND_VAL_EX                                                  'Y-m-d+H%3Ai%3As'
         94        DO_FCALL                                          0  $47     
         95        SEND_VAR                                                     $47
         96        DO_ICALL                                                     
   26    97        INIT_FCALL                                                   'printf'
         98        SEND_VAL                                                     'end%3D%25s%0A'
         99        FETCH_OBJ_R                                          ~49     !6, 'end'
        100      > JMPZ                                                         ~49, ->107
        101    >   FETCH_OBJ_R                                          ~50     !6, 'end'
        102        INIT_METHOD_CALL                                             ~50, 'format'
        103        SEND_VAL_EX                                                  'Y-m-d+H%3Ai%3As'
        104        DO_FCALL                                          0  $51     
        105        QM_ASSIGN                                            ~52     $51
        106      > JMP                                                          ->108
        107    >   QM_ASSIGN                                            ~52     'null'
        108    >   SEND_VAL                                                     ~52
        109        DO_ICALL                                                     
   27   110        INIT_FCALL                                                   'printf'
        111        SEND_VAL                                                     'interval%3D%25s%0A'
        112        FETCH_OBJ_R                                          ~54     !6, 'interval'
        113        INIT_METHOD_CALL                                             ~54, 'format'
        114        SEND_VAL_EX                                                  'P%25r%25yY%25mM%25dDT%25hH%25iM%25sS+%28%25ad%29'
        115        DO_FCALL                                          0  $55     
        116        SEND_VAR                                                     $55
        117        DO_ICALL                                                     
   28   118        INIT_FCALL                                                   'printf'
        119        SEND_VAL                                                     'recurrences%3D%25s%0A'
        120        FETCH_OBJ_R                                          ~57     !6, 'recurrences'
        121        SEND_VAL                                                     ~57
        122        DO_ICALL                                                     
   29   123        INIT_FCALL                                                   'printf'
        124        SEND_VAL                                                     'include_start_date%3D%25s%0A'
        125        FETCH_OBJ_R                                          ~59     !6, 'include_start_date'
        126        SEND_VAL                                                     ~59
        127        DO_ICALL                                                     
   30   128      > JMP                                                          ->130
   23   129*       JMP                                                          ->80
        130    >   FE_FREE                                                      $42
   31   131      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
200.95 ms | 2284 KiB | 14 Q