3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dates = array('2014-12-13','2014-12-14','2014-12-15','2014-12-20','2014-12-21','2014-12-22','2014-01-01','2015-02-02'); $first_day_of_week = 1; $day_of_week = date('w'); $sow_offset = ($day_of_week - $first_day_of_week + 7)%7 * 24*60*60; $week_first_day = date('Y-m-d', time()-$sow_offset); $nsow_offset = ((6 - $day_of_week + $first_day_of_week + 7)%7 +1) * 24*60*60; $next_week_first_day = date('Y-m-d', time()+$nsow_offset); echo "\ntoday: ".date("Y-m-d")." (".strtotime(date("Y-m-d")).")"; echo "\nweek_first_day: ".$week_first_day." (".strtotime($week_first_day).")"; echo "\nnext_week_first_day: ".$next_week_first_day." (".strtotime($next_week_first_day).")"; echo "\n\n"; foreach ($dates as $date) { echo "\ndate: ".$date." (".strtotime($date).")"; echo "\nThis Week? ".((strtotime($week_first_day) <= strtotime($date) && strtotime($date) < strtotime($next_week_first_day)) ? "YES" : "NO"); echo "\n\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 70, Position 2 = 103
Branch analysis from position: 70
2 jumps found. (Code = 78) Position 1 = 71, Position 2 = 103
Branch analysis from position: 71
2 jumps found. (Code = 46) Position 1 = 87, Position 2 = 95
Branch analysis from position: 87
2 jumps found. (Code = 43) Position 1 = 96, Position 2 = 98
Branch analysis from position: 96
1 jumps found. (Code = 42) Position 1 = 99
Branch analysis from position: 99
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
Branch analysis from position: 98
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
Branch analysis from position: 95
Branch analysis from position: 103
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 103
filename:       /in/EgSYK
function name:  (null)
number of ops:  105
compiled vars:  !0 = $dates, !1 = $first_day_of_week, !2 = $day_of_week, !3 = $sow_offset, !4 = $week_first_day, !5 = $nsow_offset, !6 = $next_week_first_day, !7 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, 1
    4     2        INIT_FCALL                                               'date'
          3        SEND_VAL                                                 'w'
          4        DO_ICALL                                         $10     
          5        ASSIGN                                                   !2, $10
    5     6        SUB                                              ~12     !2, !1
          7        ADD                                              ~13     ~12, 7
          8        MOD                                              ~14     ~13, 7
          9        MUL                                              ~15     ~14, 24
         10        MUL                                              ~16     ~15, 60
         11        MUL                                              ~17     ~16, 60
         12        ASSIGN                                                   !3, ~17
    6    13        INIT_FCALL                                               'date'
         14        SEND_VAL                                                 'Y-m-d'
         15        INIT_FCALL                                               'time'
         16        DO_ICALL                                         $19     
         17        SUB                                              ~20     $19, !3
         18        SEND_VAL                                                 ~20
         19        DO_ICALL                                         $21     
         20        ASSIGN                                                   !4, $21
    7    21        SUB                                              ~23     6, !2
         22        ADD                                              ~24     ~23, !1
         23        ADD                                              ~25     ~24, 7
         24        MOD                                              ~26     ~25, 7
         25        ADD                                              ~27     ~26, 1
         26        MUL                                              ~28     ~27, 24
         27        MUL                                              ~29     ~28, 60
         28        MUL                                              ~30     ~29, 60
         29        ASSIGN                                                   !5, ~30
    8    30        INIT_FCALL                                               'date'
         31        SEND_VAL                                                 'Y-m-d'
         32        INIT_FCALL                                               'time'
         33        DO_ICALL                                         $32     
         34        ADD                                              ~33     $32, !5
         35        SEND_VAL                                                 ~33
         36        DO_ICALL                                         $34     
         37        ASSIGN                                                   !6, $34
    9    38        INIT_FCALL                                               'date'
         39        SEND_VAL                                                 'Y-m-d'
         40        DO_ICALL                                         $36     
         41        CONCAT                                           ~37     '%0Atoday%3A+', $36
         42        CONCAT                                           ~38     ~37, '+%28'
         43        INIT_FCALL                                               'strtotime'
         44        INIT_FCALL                                               'date'
         45        SEND_VAL                                                 'Y-m-d'
         46        DO_ICALL                                         $39     
         47        SEND_VAR                                                 $39
         48        DO_ICALL                                         $40     
         49        CONCAT                                           ~41     ~38, $40
         50        CONCAT                                           ~42     ~41, '%29'
         51        ECHO                                                     ~42
   10    52        CONCAT                                           ~43     '%0Aweek_first_day%3A+', !4
         53        CONCAT                                           ~44     ~43, '+%28'
         54        INIT_FCALL                                               'strtotime'
         55        SEND_VAR                                                 !4
         56        DO_ICALL                                         $45     
         57        CONCAT                                           ~46     ~44, $45
         58        CONCAT                                           ~47     ~46, '%29'
         59        ECHO                                                     ~47
   11    60        CONCAT                                           ~48     '%0Anext_week_first_day%3A+', !6
         61        CONCAT                                           ~49     ~48, '+%28'
         62        INIT_FCALL                                               'strtotime'
         63        SEND_VAR                                                 !6
         64        DO_ICALL                                         $50     
         65        CONCAT                                           ~51     ~49, $50
         66        CONCAT                                           ~52     ~51, '%29'
         67        ECHO                                                     ~52
   12    68        ECHO                                                     '%0A%0A'
   14    69      > FE_RESET_R                                       $53     !0, ->103
         70    > > FE_FETCH_R                                               $53, !7, ->103
   15    71    >   CONCAT                                           ~54     '%0Adate%3A+', !7
         72        CONCAT                                           ~55     ~54, '+%28'
         73        INIT_FCALL                                               'strtotime'
         74        SEND_VAR                                                 !7
         75        DO_ICALL                                         $56     
         76        CONCAT                                           ~57     ~55, $56
         77        CONCAT                                           ~58     ~57, '%29'
         78        ECHO                                                     ~58
   16    79        INIT_FCALL                                               'strtotime'
         80        SEND_VAR                                                 !4
         81        DO_ICALL                                         $59     
         82        INIT_FCALL                                               'strtotime'
         83        SEND_VAR                                                 !7
         84        DO_ICALL                                         $60     
         85        IS_SMALLER_OR_EQUAL                              ~61     $59, $60
         86      > JMPZ_EX                                          ~61     ~61, ->95
         87    >   INIT_FCALL                                               'strtotime'
         88        SEND_VAR                                                 !7
         89        DO_ICALL                                         $62     
         90        INIT_FCALL                                               'strtotime'
         91        SEND_VAR                                                 !6
         92        DO_ICALL                                         $63     
         93        IS_SMALLER                                       ~64     $62, $63
         94        BOOL                                             ~61     ~64
         95    > > JMPZ                                                     ~61, ->98
         96    >   QM_ASSIGN                                        ~65     'YES'
         97      > JMP                                                      ->99
         98    >   QM_ASSIGN                                        ~65     'NO'
         99    >   CONCAT                                           ~66     '%0AThis+Week%3F+', ~65
        100        ECHO                                                     ~66
   17   101        ECHO                                                     '%0A%0A'
   14   102      > JMP                                                      ->70
        103    >   FE_FREE                                                  $53
   18   104      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.07 ms | 1404 KiB | 19 Q