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

End of function number_of_working_days

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
172.47 ms | 2360 KiB | 16 Q