3v4l.org

run code in 500+ PHP versions simultaneously
<?php for ($w = 0; $w < 4; ++$w) { var_dump('week ' . $w); $day = date('w') - 1; $day += 7 * $w; var_dump($day); $startDate = date('Y-m-d', strtotime('-' . $day . ' days')); var_dump($startDate); var_dump('+' . (6 - $day) . ' days'); $endDate = date('Y-m-d', strtotime((6 - $day) . ' days')); var_dump($endDate); $weekNumber = new \Datetime($startDate); $weekNumber = $weekNumber->format('W'); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 2
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 2
Branch analysis from position: 59
Branch analysis from position: 2
filename:       /in/TVd3U
function name:  (null)
number of ops:  60
compiled vars:  !0 = $w, !1 = $day, !2 = $startDate, !3 = $endDate, !4 = $weekNumber
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 0
          1      > JMP                                                          ->57
    4     2    >   INIT_FCALL                                                   'var_dump'
          3        CONCAT                                               ~6      'week+', !0
          4        SEND_VAL                                                     ~6
          5        DO_ICALL                                                     
    5     6        INIT_FCALL                                                   'date'
          7        SEND_VAL                                                     'w'
          8        DO_ICALL                                             $8      
          9        SUB                                                  ~9      $8, 1
         10        ASSIGN                                                       !1, ~9
    6    11        MUL                                                  ~11     !0, 7
         12        ASSIGN_OP                                         1          !1, ~11
    7    13        INIT_FCALL                                                   'var_dump'
         14        SEND_VAR                                                     !1
         15        DO_ICALL                                                     
    8    16        INIT_FCALL                                                   'date'
         17        SEND_VAL                                                     'Y-m-d'
         18        INIT_FCALL                                                   'strtotime'
         19        CONCAT                                               ~14     '-', !1
         20        CONCAT                                               ~15     ~14, '+days'
         21        SEND_VAL                                                     ~15
         22        DO_ICALL                                             $16     
         23        SEND_VAR                                                     $16
         24        DO_ICALL                                             $17     
         25        ASSIGN                                                       !2, $17
    9    26        INIT_FCALL                                                   'var_dump'
         27        SEND_VAR                                                     !2
         28        DO_ICALL                                                     
   10    29        INIT_FCALL                                                   'var_dump'
         30        SUB                                                  ~20     6, !1
         31        CONCAT                                               ~21     '%2B', ~20
         32        CONCAT                                               ~22     ~21, '+days'
         33        SEND_VAL                                                     ~22
         34        DO_ICALL                                                     
   11    35        INIT_FCALL                                                   'date'
         36        SEND_VAL                                                     'Y-m-d'
         37        INIT_FCALL                                                   'strtotime'
         38        SUB                                                  ~24     6, !1
         39        CONCAT                                               ~25     ~24, '+days'
         40        SEND_VAL                                                     ~25
         41        DO_ICALL                                             $26     
         42        SEND_VAR                                                     $26
         43        DO_ICALL                                             $27     
         44        ASSIGN                                                       !3, $27
   12    45        INIT_FCALL                                                   'var_dump'
         46        SEND_VAR                                                     !3
         47        DO_ICALL                                                     
   13    48        NEW                                                  $30     'Datetime'
         49        SEND_VAR_EX                                                  !2
         50        DO_FCALL                                          0          
         51        ASSIGN                                                       !4, $30
   14    52        INIT_METHOD_CALL                                             !4, 'format'
         53        SEND_VAL_EX                                                  'W'
         54        DO_FCALL                                          0  $33     
         55        ASSIGN                                                       !4, $33
    3    56        PRE_INC                                                      !0
         57    >   IS_SMALLER                                                   !0, 4
         58      > JMPNZ                                                        ~36, ->2
   15    59    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
128.16 ms | 486 KiB | 10 Q