3v4l.org

run code in 300+ PHP versions simultaneously
<?php $month=11; $year=2014; // Mantech $startDate = strtotime($month.'/1/'.$year); $stopDate = strtotime('last day of this month ',$startDate); if (date('D',$startDate)!='Sat'){ $startDate = strtotime('next saturday',$startDate); } if (date('D',$stopDate)!='Fri'){ $stopDate = strtotime('next friday',$stopDate); } // See if our contract is a monthly or weekly submit model $startWeek = date('W',$startDate); $stopWeek = date('W',$stopDate); // Format startweek as ISO8601 eg.2014W15 $beginWeek = date('o',$startWeek).'W'.date('W',$startWeek); for ($i=0; $i<=$stopWeek-$startWeek; $i++){ $thisWeek = strtotime($beginWeek.' +'.$i.' weeks'); $mask = ''; for ($j=0; $j<7; $j++){ $thisDay = strtotime('+'.$j.' days',$thisWeek); if ($startDate<=$thisDay or $thisDay<=$stopDate){ $mask=$mask.'1'; } else { $mask=$mask.'0'; } } echo $mask."\n"; } echo (date('Y-m-d',$startDate).' - '.date('Y-m-d',$stopDate)."\n");
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 24
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 35
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 91
Branch analysis from position: 91
2 jumps found. (Code = 44) Position 1 = 94, Position 2 = 58
Branch analysis from position: 94
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
2 jumps found. (Code = 44) Position 1 = 88, Position 2 = 68
Branch analysis from position: 88
2 jumps found. (Code = 44) Position 1 = 94, Position 2 = 58
Branch analysis from position: 94
Branch analysis from position: 58
Branch analysis from position: 68
2 jumps found. (Code = 47) Position 1 = 77, Position 2 = 79
Branch analysis from position: 77
2 jumps found. (Code = 43) Position 1 = 80, Position 2 = 83
Branch analysis from position: 80
1 jumps found. (Code = 42) Position 1 = 85
Branch analysis from position: 85
2 jumps found. (Code = 44) Position 1 = 88, Position 2 = 68
Branch analysis from position: 88
Branch analysis from position: 68
Branch analysis from position: 83
2 jumps found. (Code = 44) Position 1 = 88, Position 2 = 68
Branch analysis from position: 88
Branch analysis from position: 68
Branch analysis from position: 79
Branch analysis from position: 35
Branch analysis from position: 24
filename:       /in/qagVH
function name:  (null)
number of ops:  107
compiled vars:  !0 = $month, !1 = $year, !2 = $startDate, !3 = $stopDate, !4 = $startWeek, !5 = $stopWeek, !6 = $beginWeek, !7 = $i, !8 = $thisWeek, !9 = $mask, !10 = $j, !11 = $thisDay
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 11
    3     1        ASSIGN                                                   !1, 2014
    6     2        INIT_FCALL                                               'strtotime'
          3        CONCAT                                           ~14     !0, '%2F1%2F'
          4        CONCAT                                           ~15     ~14, !1
          5        SEND_VAL                                                 ~15
          6        DO_ICALL                                         $16     
          7        ASSIGN                                                   !2, $16
    7     8        INIT_FCALL                                               'strtotime'
          9        SEND_VAL                                                 'last+day+of+this+month+'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $18     
         12        ASSIGN                                                   !3, $18
    9    13        INIT_FCALL                                               'date'
         14        SEND_VAL                                                 'D'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $20     
         17        IS_NOT_EQUAL                                             $20, 'Sat'
         18      > JMPZ                                                     ~21, ->24
   10    19    >   INIT_FCALL                                               'strtotime'
         20        SEND_VAL                                                 'next+saturday'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $22     
         23        ASSIGN                                                   !2, $22
   12    24    >   INIT_FCALL                                               'date'
         25        SEND_VAL                                                 'D'
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                         $24     
         28        IS_NOT_EQUAL                                             $24, 'Fri'
         29      > JMPZ                                                     ~25, ->35
   13    30    >   INIT_FCALL                                               'strtotime'
         31        SEND_VAL                                                 'next+friday'
         32        SEND_VAR                                                 !3
         33        DO_ICALL                                         $26     
         34        ASSIGN                                                   !3, $26
   20    35    >   INIT_FCALL                                               'date'
         36        SEND_VAL                                                 'W'
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                         $28     
         39        ASSIGN                                                   !4, $28
   21    40        INIT_FCALL                                               'date'
         41        SEND_VAL                                                 'W'
         42        SEND_VAR                                                 !3
         43        DO_ICALL                                         $30     
         44        ASSIGN                                                   !5, $30
   24    45        INIT_FCALL                                               'date'
         46        SEND_VAL                                                 'o'
         47        SEND_VAR                                                 !4
         48        DO_ICALL                                         $32     
         49        CONCAT                                           ~33     $32, 'W'
         50        INIT_FCALL                                               'date'
         51        SEND_VAL                                                 'W'
         52        SEND_VAR                                                 !4
         53        DO_ICALL                                         $34     
         54        CONCAT                                           ~35     ~33, $34
         55        ASSIGN                                                   !6, ~35
   26    56        ASSIGN                                                   !7, 0
         57      > JMP                                                      ->91
   27    58    >   INIT_FCALL                                               'strtotime'
         59        CONCAT                                           ~38     !6, '+%2B'
         60        CONCAT                                           ~39     ~38, !7
         61        CONCAT                                           ~40     ~39, '+weeks'
         62        SEND_VAL                                                 ~40
         63        DO_ICALL                                         $41     
         64        ASSIGN                                                   !8, $41
   28    65        ASSIGN                                                   !9, ''
   29    66        ASSIGN                                                   !10, 0
         67      > JMP                                                      ->86
   30    68    >   INIT_FCALL                                               'strtotime'
         69        CONCAT                                           ~45     '%2B', !10
         70        CONCAT                                           ~46     ~45, '+days'
         71        SEND_VAL                                                 ~46
         72        SEND_VAR                                                 !8
         73        DO_ICALL                                         $47     
         74        ASSIGN                                                   !11, $47
   31    75        IS_SMALLER_OR_EQUAL                              ~49     !2, !11
         76      > JMPNZ_EX                                         ~49     ~49, ->79
         77    >   IS_SMALLER_OR_EQUAL                              ~50     !11, !3
         78        BOOL                                             ~49     ~50
         79    > > JMPZ                                                     ~49, ->83
   32    80    >   CONCAT                                           ~51     !9, '1'
         81        ASSIGN                                                   !9, ~51
         82      > JMP                                                      ->85
   34    83    >   CONCAT                                           ~53     !9, '0'
         84        ASSIGN                                                   !9, ~53
   29    85    >   PRE_INC                                                  !10
         86    >   IS_SMALLER                                               !10, 7
         87      > JMPNZ                                                    ~56, ->68
   37    88    >   CONCAT                                           ~57     !9, '%0A'
         89        ECHO                                                     ~57
   26    90        PRE_INC                                                  !7
         91    >   SUB                                              ~59     !5, !4
         92        IS_SMALLER_OR_EQUAL                                      !7, ~59
         93      > JMPNZ                                                    ~60, ->58
   41    94    >   INIT_FCALL                                               'date'
         95        SEND_VAL                                                 'Y-m-d'
         96        SEND_VAR                                                 !2
         97        DO_ICALL                                         $61     
         98        CONCAT                                           ~62     $61, '+-+'
         99        INIT_FCALL                                               'date'
        100        SEND_VAL                                                 'Y-m-d'
        101        SEND_VAR                                                 !3
        102        DO_ICALL                                         $63     
        103        CONCAT                                           ~64     ~62, $63
        104        CONCAT                                           ~65     ~64, '%0A'
        105        ECHO                                                     ~65
        106      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.77 ms | 1404 KiB | 17 Q