3v4l.org

run code in 300+ PHP versions simultaneously
<?php $holidayList = array("04-03-2008","07-03-2008"); $j = $i = 0; //changed this to 0 or you were always starting one day ahead $given_date = "04/09/2013 13:06:00"; $tmp1 = strtotime($given_date); //worked out a timstamp to start with while($i < 5) { $tmp2 = strtotime("+$j day", $tmp1); $day = strftime("%A",$tmp2); echo strftime("%d-%m-%Y",$tmp2); $tmp = strftime("%d-%m-%Y",$tmp2); if(($day != "Sunday") && ($day != "Saturday" )&&(!in_array($tmp, $holidayList))) { $i = $i + 1; $j = $j + 1; } else { $j = $j + 1; } } $j = $j -1; $newdate = strtotime("+$j day",$tmp1); $working_days = strftime("%A, %d-%m-%Y",$newdate);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 9
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
2 jumps found. (Code = 46) Position 1 = 37, Position 2 = 43
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 49
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 9
Branch analysis from position: 53
Branch analysis from position: 9
Branch analysis from position: 43
Branch analysis from position: 36
filename:       /in/4KhmA
function name:  (null)
number of ops:  69
compiled vars:  !0 = $holidayList, !1 = $j, !2 = $i, !3 = $given_date, !4 = $tmp1, !5 = $tmp2, !6 = $day, !7 = $tmp, !8 = $newdate, !9 = $working_days
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                           ~11     !2, 0
          2        ASSIGN                                                   !1, ~11
    5     3        ASSIGN                                                   !3, '04%2F09%2F2013+13%3A06%3A00'
    6     4        INIT_FCALL                                               'strtotime'
          5        SEND_VAR                                                 !3
          6        DO_ICALL                                         $14     
          7        ASSIGN                                                   !4, $14
    7     8      > JMP                                                      ->51
    9     9    >   INIT_FCALL                                               'strtotime'
         10        ROPE_INIT                                     3  ~17     '%2B'
         11        ROPE_ADD                                      1  ~17     ~17, !1
         12        ROPE_END                                      2  ~16     ~17, '+day'
         13        SEND_VAL                                                 ~16
         14        SEND_VAR                                                 !4
         15        DO_ICALL                                         $19     
         16        ASSIGN                                                   !5, $19
   10    17        INIT_FCALL                                               'strftime'
         18        SEND_VAL                                                 '%25A'
         19        SEND_VAR                                                 !5
         20        DO_ICALL                                         $21     
         21        ASSIGN                                                   !6, $21
   11    22        INIT_FCALL                                               'strftime'
         23        SEND_VAL                                                 '%25d-%25m-%25Y'
         24        SEND_VAR                                                 !5
         25        DO_ICALL                                         $23     
         26        ECHO                                                     $23
   13    27        INIT_FCALL                                               'strftime'
         28        SEND_VAL                                                 '%25d-%25m-%25Y'
         29        SEND_VAR                                                 !5
         30        DO_ICALL                                         $24     
         31        ASSIGN                                                   !7, $24
   14    32        IS_NOT_EQUAL                                     ~26     !6, 'Sunday'
         33      > JMPZ_EX                                          ~26     ~26, ->36
         34    >   IS_NOT_EQUAL                                     ~27     !6, 'Saturday'
         35        BOOL                                             ~26     ~27
         36    > > JMPZ_EX                                          ~26     ~26, ->43
         37    >   INIT_FCALL                                               'in_array'
         38        SEND_VAR                                                 !7
         39        SEND_VAR                                                 !0
         40        DO_ICALL                                         $28     
         41        BOOL_NOT                                         ~29     $28
         42        BOOL                                             ~26     ~29
         43    > > JMPZ                                                     ~26, ->49
   16    44    >   ADD                                              ~30     !2, 1
         45        ASSIGN                                                   !2, ~30
   17    46        ADD                                              ~32     !1, 1
         47        ASSIGN                                                   !1, ~32
         48      > JMP                                                      ->51
   22    49    >   ADD                                              ~34     !1, 1
         50        ASSIGN                                                   !1, ~34
    7    51    >   IS_SMALLER                                               !2, 5
         52      > JMPNZ                                                    ~36, ->9
   26    53    >   SUB                                              ~37     !1, 1
         54        ASSIGN                                                   !1, ~37
   27    55        INIT_FCALL                                               'strtotime'
         56        ROPE_INIT                                     3  ~40     '%2B'
         57        ROPE_ADD                                      1  ~40     ~40, !1
         58        ROPE_END                                      2  ~39     ~40, '+day'
         59        SEND_VAL                                                 ~39
         60        SEND_VAR                                                 !4
         61        DO_ICALL                                         $42     
         62        ASSIGN                                                   !8, $42
   28    63        INIT_FCALL                                               'strftime'
         64        SEND_VAL                                                 '%25A%2C+%25d-%25m-%25Y'
         65        SEND_VAR                                                 !8
         66        DO_ICALL                                         $44     
         67        ASSIGN                                                   !9, $44
         68      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.47 ms | 1400 KiB | 19 Q