3v4l.org

run code in 300+ PHP versions simultaneously
<?php $startDate = DateTimeImmutable::createFromFormat('Y-m-d', '2018-01-01'); $dateInterval = new DateInterval('P1D'); $dateRange = new DatePeriod($startDate, $dateInterval, new DateTimeImmutable); foreach($dateRange as $date) { if (in_array($date->format('w'), [0, 6])) { echo 'weekend'; continue; } echo $date->current->format('Y-m-d'); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 35
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 35
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/ossXj
function name:  (null)
number of ops:  37
compiled vars:  !0 = $startDate, !1 = $dateInterval, !2 = $dateRange, !3 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_STATIC_METHOD_CALL                                  'DateTimeImmutable', 'createFromFormat'
          1        SEND_VAL                                                 'Y-m-d'
          2        SEND_VAL                                                 '2018-01-01'
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !0, $4
    4     5        NEW                                              $6      'DateInterval'
          6        SEND_VAL_EX                                              'P1D'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $6
    5     9        NEW                                              $9      'DatePeriod'
         10        SEND_VAR_EX                                              !0
         11        SEND_VAR_EX                                              !1
         12        NEW                                              $10     'DateTimeImmutable'
         13        DO_FCALL                                      0          
         14        SEND_VAR_NO_REF_EX                                       $10
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !2, $9
    7    17      > FE_RESET_R                                       $14     !2, ->35
         18    > > FE_FETCH_R                                               $14, !3, ->35
    8    19    >   INIT_FCALL                                               'in_array'
         20        INIT_METHOD_CALL                                         !3, 'format'
         21        SEND_VAL_EX                                              'w'
         22        DO_FCALL                                      0  $15     
         23        SEND_VAR                                                 $15
         24        SEND_VAL                                                 <array>
         25        DO_ICALL                                         $16     
         26      > JMPZ                                                     $16, ->29
    9    27    >   ECHO                                                     'weekend'
   10    28      > JMP                                                      ->18
   13    29    >   FETCH_OBJ_R                                      ~17     !3, 'current'
         30        INIT_METHOD_CALL                                         ~17, 'format'
         31        SEND_VAL_EX                                              'Y-m-d'
         32        DO_FCALL                                      0  $18     
         33        ECHO                                                     $18
    7    34      > JMP                                                      ->18
         35    >   FE_FREE                                                  $14
   14    36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.39 ms | 1396 KiB | 15 Q