3v4l.org

run code in 300+ PHP versions simultaneously
<?php $no = 0; $start = new DateTime('2022-09-01'); $end = new DateTime('2022-09-19'); $interval = DateInterval::createFromDateString('1 day'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $dt) { print_r($dt->format('N'))."<br/>"; 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 = 36
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 36
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 35
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 35
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/N6b7s
function name:  (null)
number of ops:  39
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-19'
          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
    8    19      > FE_RESET_R                                       $18     !4, ->36
         20    > > FE_FETCH_R                                               $18, !5, ->36
   10    21    >   INIT_FCALL                                               'print_r'
         22        INIT_METHOD_CALL                                         !5, 'format'
         23        SEND_VAL_EX                                              'N'
         24        DO_FCALL                                      0  $19     
         25        SEND_VAR                                                 $19
         26        DO_ICALL                                         $20     
         27        CONCAT                                           ~21     $20, '%3Cbr%2F%3E'
         28        FREE                                                     ~21
   11    29        INIT_METHOD_CALL                                         !5, 'format'
         30        SEND_VAL_EX                                              'N'
         31        DO_FCALL                                      0  $22     
         32        IS_EQUAL                                                 $22, 7
         33      > JMPZ                                                     ~23, ->35
   13    34    >   PRE_INC                                                  !0
    8    35    > > JMP                                                      ->20
         36    >   FE_FREE                                                  $18
   16    37        ECHO                                                     !0
   17    38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.03 ms | 945 KiB | 16 Q