3v4l.org

run code in 300+ PHP versions simultaneously
<?php $startdate = '2017-08-04'; $datetime1 = new DateTime($startdate); $datetime2 = new DateTime('2017-08-07'); $interval = $datetime1->diff($datetime2); $days = $interval->format('%a'); $arr =array(); for($i=0;$i<=$days;$i++){ $day = date("w Y-m-d l", strtotime($startdate) + $i*86400); if((int)$day[0] >= 1 && (int)$day[0] <= 5 ) $arr[] = $day; } var_dump($arr); echo "days excluding sat-sundays " . count($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 20
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 34, Position 2 = 38
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 41
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 20
Branch analysis from position: 44
Branch analysis from position: 20
Branch analysis from position: 41
Branch analysis from position: 38
filename:       /in/pPLpb
function name:  (null)
number of ops:  51
compiled vars:  !0 = $startdate, !1 = $datetime1, !2 = $datetime2, !3 = $interval, !4 = $days, !5 = $arr, !6 = $i, !7 = $day
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2017-08-04'
    5     1        NEW                                              $9      'DateTime'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $9
    6     5        NEW                                              $12     'DateTime'
          6        SEND_VAL_EX                                              '2017-08-07'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $12
    7     9        INIT_METHOD_CALL                                         !1, 'diff'
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0  $15     
         12        ASSIGN                                                   !3, $15
    8    13        INIT_METHOD_CALL                                         !3, 'format'
         14        SEND_VAL_EX                                              '%25a'
         15        DO_FCALL                                      0  $17     
         16        ASSIGN                                                   !4, $17
   10    17        ASSIGN                                                   !5, <array>
   11    18        ASSIGN                                                   !6, 0
         19      > JMP                                                      ->42
   12    20    >   INIT_FCALL                                               'date'
         21        SEND_VAL                                                 'w+Y-m-d+l'
         22        INIT_FCALL                                               'strtotime'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $21     
         25        MUL                                              ~22     !6, 86400
         26        ADD                                              ~23     $21, ~22
         27        SEND_VAL                                                 ~23
         28        DO_ICALL                                         $24     
         29        ASSIGN                                                   !7, $24
   13    30        FETCH_DIM_R                                      ~26     !7, 0
         31        CAST                                          4  ~27     ~26
         32        IS_SMALLER_OR_EQUAL                              ~28     1, ~27
         33      > JMPZ_EX                                          ~28     ~28, ->38
         34    >   FETCH_DIM_R                                      ~29     !7, 0
         35        CAST                                          4  ~30     ~29
         36        IS_SMALLER_OR_EQUAL                              ~31     ~30, 5
         37        BOOL                                             ~28     ~31
         38    > > JMPZ                                                     ~28, ->41
         39    >   ASSIGN_DIM                                               !5
         40        OP_DATA                                                  !7
   11    41    >   PRE_INC                                                  !6
         42    >   IS_SMALLER_OR_EQUAL                                      !6, !4
         43      > JMPNZ                                                    ~34, ->20
   16    44    >   INIT_FCALL                                               'var_dump'
         45        SEND_VAR                                                 !5
         46        DO_ICALL                                                 
   18    47        COUNT                                            ~36     !5
         48        CONCAT                                           ~37     'days+excluding+sat-sundays+', ~36
         49        ECHO                                                     ~37
         50      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.59 ms | 1009 KiB | 16 Q