3v4l.org

run code in 300+ PHP versions simultaneously
<?php $startDate = new DateTime('2018-05-07'); $endDate = new DateTime('2019-07-04'); $dateInterval = new DateInterval('P1D'); $datePeriod = new DatePeriod($startDate, $dateInterval, $endDate); $fourteenths = []; foreach ($datePeriod as $dt) { if ($dt->format('d') == '14') { // Note this is losely checked! $fourteenths[] = $dt->format('Y-m-d'); } } echo count($fourteenths) . PHP_EOL; var_dump($fourteenths);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 32
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 32
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 31
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/vPZZ0
function name:  (null)
number of ops:  40
compiled vars:  !0 = $startDate, !1 = $endDate, !2 = $dateInterval, !3 = $datePeriod, !4 = $fourteenths, !5 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $6      'DateTime'
          1        SEND_VAL_EX                                              '2018-05-07'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $6
    4     4        NEW                                              $9      'DateTime'
          5        SEND_VAL_EX                                              '2019-07-04'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $9
    6     8        NEW                                              $12     'DateInterval'
          9        SEND_VAL_EX                                              'P1D'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $12
    7    12        NEW                                              $15     'DatePeriod'
         13        SEND_VAR_EX                                              !0
         14        SEND_VAR_EX                                              !2
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !3, $15
    9    18        ASSIGN                                                   !4, <array>
   11    19      > FE_RESET_R                                       $19     !3, ->32
         20    > > FE_FETCH_R                                               $19, !5, ->32
   12    21    >   INIT_METHOD_CALL                                         !5, 'format'
         22        SEND_VAL_EX                                              'd'
         23        DO_FCALL                                      0  $20     
         24        IS_EQUAL                                                 $20, '14'
         25      > JMPZ                                                     ~21, ->31
   13    26    >   INIT_METHOD_CALL                                         !5, 'format'
         27        SEND_VAL_EX                                              'Y-m-d'
         28        DO_FCALL                                      0  $23     
         29        ASSIGN_DIM                                               !4
         30        OP_DATA                                                  $23
   11    31    > > JMP                                                      ->20
         32    >   FE_FREE                                                  $19
   17    33        COUNT                                            ~24     !4
         34        CONCAT                                           ~25     ~24, '%0A'
         35        ECHO                                                     ~25
   18    36        INIT_FCALL                                               'var_dump'
         37        SEND_VAR                                                 !4
         38        DO_ICALL                                                 
         39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
287.65 ms | 1015 KiB | 14 Q