3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = new DateTime('2019-01-01'); $end = new DateTime('2019-02-27'); $interval = new DateInterval('P1D'); $days = 19; while ($start < $end) { echo $start->format('Y-m-d') . ' => '; for ($i = 0; $i < $days; ) { $start->add($interval); $day_of_week = $start->format('N'); if ($day_of_week == 6 || $day_of_week == 7) continue; $i++; } echo min($start, $end)->format('Y-m-d') . "\n"; $start->add($interval); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 14
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 21
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 14
Branch analysis from position: 51
Branch analysis from position: 14
Branch analysis from position: 21
2 jumps found. (Code = 47) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 34
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 21
Branch analysis from position: 37
Branch analysis from position: 21
Branch analysis from position: 32
filename:       /in/0iXt3
function name:  (null)
number of ops:  52
compiled vars:  !0 = $start, !1 = $end, !2 = $interval, !3 = $days, !4 = $i, !5 = $day_of_week
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $6      'DateTime'
          1        SEND_VAL_EX                                              '2019-01-01'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $6
    3     4        NEW                                              $9      'DateTime'
          5        SEND_VAL_EX                                              '2019-02-27'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $9
    4     8        NEW                                              $12     'DateInterval'
          9        SEND_VAL_EX                                              'P1D'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $12
    5    12        ASSIGN                                                   !3, 19
    6    13      > JMP                                                      ->49
    7    14    >   INIT_METHOD_CALL                                         !0, 'format'
         15        SEND_VAL_EX                                              'Y-m-d'
         16        DO_FCALL                                      0  $16     
         17        CONCAT                                           ~17     $16, '+%3D%3E+'
         18        ECHO                                                     ~17
    8    19        ASSIGN                                                   !4, 0
         20      > JMP                                                      ->35
    9    21    >   INIT_METHOD_CALL                                         !0, 'add'
         22        SEND_VAR_EX                                              !2
         23        DO_FCALL                                      0          
   10    24        INIT_METHOD_CALL                                         !0, 'format'
         25        SEND_VAL_EX                                              'N'
         26        DO_FCALL                                      0  $20     
         27        ASSIGN                                                   !5, $20
   11    28        IS_EQUAL                                         ~22     !5, 6
         29      > JMPNZ_EX                                         ~22     ~22, ->32
         30    >   IS_EQUAL                                         ~23     !5, 7
         31        BOOL                                             ~22     ~23
         32    > > JMPZ                                                     ~22, ->34
         33    > > JMP                                                      ->35
   12    34    >   PRE_INC                                                  !4
    8    35    >   IS_SMALLER                                               !4, !3
         36      > JMPNZ                                                    ~25, ->21
   14    37    >   INIT_FCALL                                               'min'
         38        SEND_VAR                                                 !0
         39        SEND_VAR                                                 !1
         40        DO_ICALL                                         $26     
         41        INIT_METHOD_CALL                                         $26, 'format'
         42        SEND_VAL_EX                                              'Y-m-d'
         43        DO_FCALL                                      0  $27     
         44        CONCAT                                           ~28     $27, '%0A'
         45        ECHO                                                     ~28
   15    46        INIT_METHOD_CALL                                         !0, 'add'
         47        SEND_VAR_EX                                              !2
         48        DO_FCALL                                      0          
    6    49    >   IS_SMALLER                                               !0, !1
         50      > JMPNZ                                                    ~30, ->14
   16    51    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.12 ms | 1005 KiB | 14 Q