3v4l.org

run code in 500+ PHP versions simultaneously
<?php function number_of_working_days($startDate, $endDate) { $workingDays = 0; $startTimestamp = strtotime($startDate); $endTimestamp = strtotime($endDate); for ($i = $startTimestamp; $i <= $endTimestamp; $i = $i + (60 * 60 * 24)) { if (date("N", $i) <= 5) $workingDays = $workingDays + 1; echo $i.' '.date("d.m.Y H:i:s", $i).' '.date("D", $i).' '.date("N", $i).' '.$workingDays."\n"; } return $workingDays; } echo number_of_working_days('2016-10-20', '2016-10-31');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nI3pW
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                                   'number_of_working_days'
          1        SEND_VAL                                                     '2016-10-20'
          2        SEND_VAL                                                     '2016-10-31'
          3        DO_FCALL                                          0  $0      
          4        ECHO                                                         $0
          5      > RETURN                                                       1

Function number_of_working_days:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 13
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 13
Branch analysis from position: 47
Branch analysis from position: 13
Branch analysis from position: 21
filename:       /in/nI3pW
function name:  number_of_working_days
number of ops:  49
compiled vars:  !0 = $startDate, !1 = $endDate, !2 = $workingDays, !3 = $startTimestamp, !4 = $endTimestamp, !5 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    5     2        ASSIGN                                                       !2, 0
    6     3        INIT_FCALL                                                   'strtotime'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $7      
          6        ASSIGN                                                       !3, $7
    7     7        INIT_FCALL                                                   'strtotime'
          8        SEND_VAR                                                     !1
          9        DO_ICALL                                             $9      
         10        ASSIGN                                                       !4, $9
    8    11        ASSIGN                                                       !5, !3
         12      > JMP                                                          ->45
    9    13    >   INIT_FCALL                                                   'date'
         14        SEND_VAL                                                     'N'
         15        SEND_VAR                                                     !5
         16        DO_ICALL                                             $12     
         17        IS_SMALLER_OR_EQUAL                                          $12, 5
         18      > JMPZ                                                         ~13, ->21
         19    >   ADD                                                  ~14     !2, 1
         20        ASSIGN                                                       !2, ~14
   10    21    >   CONCAT                                               ~16     !5, '+'
         22        INIT_FCALL                                                   'date'
         23        SEND_VAL                                                     'd.m.Y+H%3Ai%3As'
         24        SEND_VAR                                                     !5
         25        DO_ICALL                                             $17     
         26        CONCAT                                               ~18     ~16, $17
         27        CONCAT                                               ~19     ~18, '+'
         28        INIT_FCALL                                                   'date'
         29        SEND_VAL                                                     'D'
         30        SEND_VAR                                                     !5
         31        DO_ICALL                                             $20     
         32        CONCAT                                               ~21     ~19, $20
         33        CONCAT                                               ~22     ~21, '+'
         34        INIT_FCALL                                                   'date'
         35        SEND_VAL                                                     'N'
         36        SEND_VAR                                                     !5
         37        DO_ICALL                                             $23     
         38        CONCAT                                               ~24     ~22, $23
         39        CONCAT                                               ~25     ~24, '+'
         40        CONCAT                                               ~26     ~25, !2
         41        CONCAT                                               ~27     ~26, '%0A'
         42        ECHO                                                         ~27
    8    43        ADD                                                  ~28     !5, 86400
         44        ASSIGN                                                       !5, ~28
         45    >   IS_SMALLER_OR_EQUAL                                          !5, !4
         46      > JMPNZ                                                        ~30, ->13
   13    47    > > RETURN                                                       !2
   14    48*     > RETURN                                                       null

End of function number_of_working_days

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.2 ms | 2323 KiB | 16 Q