3v4l.org

run code in 300+ PHP versions simultaneously
<?php $year = '2015'; $week = '01'; $month = date('m', strtotime($year . 'W' . $week)); $weeks = [ '0' => ((int)$week == 1) ? date('W', strtotime('December 28th,' . $year - 1)) : (int)$week - 1, '1' => $week, '2' => (date('W', strtotime('December 28th,' . $year)) == $week) ? '01' : (int)$week + 1, '3' => (date('W', strtotime('December 28th,' . $year)) == $week) ? '01' : (int)$week + 2, '4' => (date('W', strtotime('December 28th,' . $year)) == $week) ? '01' : (int)$week + 3, '5' => (date('W', strtotime('December 28th,' . $year)) == $week) ? '01' : (int)$week + 4 ]; print_r($weeks);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 26
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 43
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 59
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 75
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
2 jumps found. (Code = 43) Position 1 = 89, Position 2 = 91
Branch analysis from position: 89
1 jumps found. (Code = 42) Position 1 = 94
Branch analysis from position: 94
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 91
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 89, Position 2 = 91
Branch analysis from position: 89
Branch analysis from position: 91
Branch analysis from position: 59
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 75
Branch analysis from position: 73
Branch analysis from position: 75
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 59
Branch analysis from position: 57
Branch analysis from position: 59
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 43
Branch analysis from position: 41
Branch analysis from position: 43
filename:       /in/ZRGqD
function name:  (null)
number of ops:  100
compiled vars:  !0 = $year, !1 = $week, !2 = $month, !3 = $weeks
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '2015'
    3     1        ASSIGN                                                   !1, '01'
    4     2        INIT_FCALL                                               'date'
          3        SEND_VAL                                                 'm'
          4        INIT_FCALL                                               'strtotime'
          5        CONCAT                                           ~6      !0, 'W'
          6        CONCAT                                           ~7      ~6, !1
          7        SEND_VAL                                                 ~7
          8        DO_ICALL                                         $8      
          9        SEND_VAR                                                 $8
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !2, $9
    7    12        CAST                                          4  ~11     !1
         13        IS_EQUAL                                                 ~11, 1
         14      > JMPZ                                                     ~12, ->26
         15    >   INIT_FCALL                                               'date'
         16        SEND_VAL                                                 'W'
         17        INIT_FCALL                                               'strtotime'
         18        SUB                                              ~13     !0, 1
         19        CONCAT                                           ~14     'December+28th%2C', ~13
         20        SEND_VAL                                                 ~14
         21        DO_ICALL                                         $15     
         22        SEND_VAR                                                 $15
         23        DO_ICALL                                         $16     
         24        QM_ASSIGN                                        ~17     $16
         25      > JMP                                                      ->29
         26    >   CAST                                          4  ~18     !1
         27        SUB                                              ~19     ~18, 1
         28        QM_ASSIGN                                        ~17     ~19
         29    >   INIT_ARRAY                                       ~20     ~17, 0
    8    30        ADD_ARRAY_ELEMENT                                ~20     !1, 1
    9    31        INIT_FCALL                                               'date'
         32        SEND_VAL                                                 'W'
         33        INIT_FCALL                                               'strtotime'
         34        CONCAT                                           ~21     'December+28th%2C', !0
         35        SEND_VAL                                                 ~21
         36        DO_ICALL                                         $22     
         37        SEND_VAR                                                 $22
         38        DO_ICALL                                         $23     
         39        IS_EQUAL                                                 !1, $23
         40      > JMPZ                                                     ~24, ->43
         41    >   QM_ASSIGN                                        ~25     '01'
         42      > JMP                                                      ->46
         43    >   CAST                                          4  ~26     !1
         44        ADD                                              ~27     ~26, 1
         45        QM_ASSIGN                                        ~25     ~27
         46    >   ADD_ARRAY_ELEMENT                                ~20     ~25, 2
   10    47        INIT_FCALL                                               'date'
         48        SEND_VAL                                                 'W'
         49        INIT_FCALL                                               'strtotime'
         50        CONCAT                                           ~28     'December+28th%2C', !0
         51        SEND_VAL                                                 ~28
         52        DO_ICALL                                         $29     
         53        SEND_VAR                                                 $29
         54        DO_ICALL                                         $30     
         55        IS_EQUAL                                                 !1, $30
         56      > JMPZ                                                     ~31, ->59
         57    >   QM_ASSIGN                                        ~32     '01'
         58      > JMP                                                      ->62
         59    >   CAST                                          4  ~33     !1
         60        ADD                                              ~34     ~33, 2
         61        QM_ASSIGN                                        ~32     ~34
         62    >   ADD_ARRAY_ELEMENT                                ~20     ~32, 3
   11    63        INIT_FCALL                                               'date'
         64        SEND_VAL                                                 'W'
         65        INIT_FCALL                                               'strtotime'
         66        CONCAT                                           ~35     'December+28th%2C', !0
         67        SEND_VAL                                                 ~35
         68        DO_ICALL                                         $36     
         69        SEND_VAR                                                 $36
         70        DO_ICALL                                         $37     
         71        IS_EQUAL                                                 !1, $37
         72      > JMPZ                                                     ~38, ->75
         73    >   QM_ASSIGN                                        ~39     '01'
         74      > JMP                                                      ->78
         75    >   CAST                                          4  ~40     !1
         76        ADD                                              ~41     ~40, 3
         77        QM_ASSIGN                                        ~39     ~41
         78    >   ADD_ARRAY_ELEMENT                                ~20     ~39, 4
   12    79        INIT_FCALL                                               'date'
         80        SEND_VAL                                                 'W'
         81        INIT_FCALL                                               'strtotime'
         82        CONCAT                                           ~42     'December+28th%2C', !0
         83        SEND_VAL                                                 ~42
         84        DO_ICALL                                         $43     
         85        SEND_VAR                                                 $43
         86        DO_ICALL                                         $44     
         87        IS_EQUAL                                                 !1, $44
         88      > JMPZ                                                     ~45, ->91
         89    >   QM_ASSIGN                                        ~46     '01'
         90      > JMP                                                      ->94
         91    >   CAST                                          4  ~47     !1
         92        ADD                                              ~48     ~47, 4
         93        QM_ASSIGN                                        ~46     ~48
         94    >   ADD_ARRAY_ELEMENT                                ~20     ~46, 5
    6    95        ASSIGN                                                   !3, ~20
   15    96        INIT_FCALL                                               'print_r'
         97        SEND_VAR                                                 !3
         98        DO_ICALL                                                 
         99      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.64 ms | 1404 KiB | 19 Q