3v4l.org

run code in 300+ PHP versions simultaneously
<?php $workdays = array(); $type = CAL_GREGORIAN; $month = date('n'); // Month ID, 1 through to 12. $year = date('Y'); // Year in 4 digit 2009 format. $day_count = cal_days_in_month($type, $month, $year); // Get the amount of days $current_date = date('Y/n/j'); //loop through all days for ($i = 1; $i <= $day_count; $i++) { $date = $year.'/'.$month.'/'.$i; //format date $get_name = date('l', strtotime($date)); //get week day $day_name = substr($get_name, 0, 3); // Trim day name to 3 chars //if not a weekend add day to array if($day_name != 'Sun' && $day_name != 'Sat' && $date <= $current_date){ $workdays[] = $date; } } foreach($workdays as $bd){ echo $bd.'<br>'; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 23
Branch analysis from position: 55
2 jumps found. (Code = 77) Position 1 = 56, Position 2 = 60
Branch analysis from position: 56
2 jumps found. (Code = 78) Position 1 = 57, Position 2 = 60
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
2 jumps found. (Code = 46) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 52
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 23
Branch analysis from position: 55
Branch analysis from position: 23
Branch analysis from position: 52
Branch analysis from position: 49
Branch analysis from position: 46
filename:       /in/7A3It
function name:  (null)
number of ops:  62
compiled vars:  !0 = $workdays, !1 = $type, !2 = $month, !3 = $year, !4 = $day_count, !5 = $current_date, !6 = $i, !7 = $date, !8 = $get_name, !9 = $day_name, !10 = $bd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        FETCH_CONSTANT                                   ~12     'CAL_GREGORIAN'
          2        ASSIGN                                                   !1, ~12
    5     3        INIT_FCALL                                               'date'
          4        SEND_VAL                                                 'n'
          5        DO_ICALL                                         $14     
          6        ASSIGN                                                   !2, $14
    6     7        INIT_FCALL                                               'date'
          8        SEND_VAL                                                 'Y'
          9        DO_ICALL                                         $16     
         10        ASSIGN                                                   !3, $16
    7    11        INIT_FCALL_BY_NAME                                       'cal_days_in_month'
         12        SEND_VAR_EX                                              !1
         13        SEND_VAR_EX                                              !2
         14        SEND_VAR_EX                                              !3
         15        DO_FCALL                                      0  $18     
         16        ASSIGN                                                   !4, $18
    8    17        INIT_FCALL                                               'date'
         18        SEND_VAL                                                 'Y%2Fn%2Fj'
         19        DO_ICALL                                         $20     
         20        ASSIGN                                                   !5, $20
   11    21        ASSIGN                                                   !6, 1
         22      > JMP                                                      ->53
   13    23    >   CONCAT                                           ~23     !3, '%2F'
         24        CONCAT                                           ~24     ~23, !2
         25        CONCAT                                           ~25     ~24, '%2F'
         26        CONCAT                                           ~26     ~25, !6
         27        ASSIGN                                                   !7, ~26
   14    28        INIT_FCALL                                               'date'
         29        SEND_VAL                                                 'l'
         30        INIT_FCALL                                               'strtotime'
         31        SEND_VAR                                                 !7
         32        DO_ICALL                                         $28     
         33        SEND_VAR                                                 $28
         34        DO_ICALL                                         $29     
         35        ASSIGN                                                   !8, $29
   15    36        INIT_FCALL                                               'substr'
         37        SEND_VAR                                                 !8
         38        SEND_VAL                                                 0
         39        SEND_VAL                                                 3
         40        DO_ICALL                                         $31     
         41        ASSIGN                                                   !9, $31
   18    42        IS_NOT_EQUAL                                     ~33     !9, 'Sun'
         43      > JMPZ_EX                                          ~33     ~33, ->46
         44    >   IS_NOT_EQUAL                                     ~34     !9, 'Sat'
         45        BOOL                                             ~33     ~34
         46    > > JMPZ_EX                                          ~33     ~33, ->49
         47    >   IS_SMALLER_OR_EQUAL                              ~35     !7, !5
         48        BOOL                                             ~33     ~35
         49    > > JMPZ                                                     ~33, ->52
   19    50    >   ASSIGN_DIM                                               !0
         51        OP_DATA                                                  !7
   11    52    >   PRE_INC                                                  !6
         53    >   IS_SMALLER_OR_EQUAL                                      !6, !4
         54      > JMPNZ                                                    ~38, ->23
   24    55    > > FE_RESET_R                                       $39     !0, ->60
         56    > > FE_FETCH_R                                               $39, !10, ->60
   26    57    >   CONCAT                                           ~40     !10, '%3Cbr%3E'
         58        ECHO                                                     ~40
   24    59      > JMP                                                      ->56
         60    >   FE_FREE                                                  $39
   27    61      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
189.58 ms | 1404 KiB | 19 Q