3v4l.org

run code in 300+ PHP versions simultaneously
<?php $no = 0; $start = new DateTime('2022-09-01'); $end = new DateTime('2022-09-18'); $interval = DateInterval::createFromDateString('1 day'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $dt) { if ($dt->format('N') == 7) { $no++; } } echo $no;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 28
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 28
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 27
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 27
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/tZtT1
function name:  (null)
number of ops:  31
compiled vars:  !0 = $no, !1 = $start, !2 = $end, !3 = $interval, !4 = $period, !5 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 0
    3     1        NEW                                              $7      'DateTime'
          2        SEND_VAL_EX                                              '2022-09-01'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $7
    4     5        NEW                                              $10     'DateTime'
          6        SEND_VAL_EX                                              '2022-09-18'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $10
    5     9        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         10        SEND_VAL                                                 '1+day'
         11        DO_FCALL                                      0  $13     
         12        ASSIGN                                                   !3, $13
    6    13        NEW                                              $15     'DatePeriod'
         14        SEND_VAR_EX                                              !1
         15        SEND_VAR_EX                                              !3
         16        SEND_VAR_EX                                              !2
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !4, $15
    7    19      > FE_RESET_R                                       $18     !4, ->28
         20    > > FE_FETCH_R                                               $18, !5, ->28
    9    21    >   INIT_METHOD_CALL                                         !5, 'format'
         22        SEND_VAL_EX                                              'N'
         23        DO_FCALL                                      0  $19     
         24        IS_EQUAL                                                 $19, 7
         25      > JMPZ                                                     ~20, ->27
   11    26    >   PRE_INC                                                  !0
    7    27    > > JMP                                                      ->20
         28    >   FE_FREE                                                  $18
   14    29        ECHO                                                     !0
   15    30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.63 ms | 1386 KiB | 13 Q