3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set("UTC"); echo "works as expected:\n"; echo date("Y-m-d H:i:s", strtotime("2019W14")) . " should be 2019-04-01\n"; echo date("Y-m-d H:i:s", strtotime("2019W15")) . " should be 2019-04-08\n"; echo date("Y-m-d H:i:s", strtotime("2019W16")) . " should be 2019-04-15\n\n"; echo "off by one:\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next tuesday")) . " should be 2019-04-16\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next wednesday")) . " should be 2019-04-17\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next thursday")) . " should be 2019-04-18\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next friday")) . " should be 2019-04-19\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next saturday")) . " should be 2019-04-20\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next sunday")) . " should be 2019-04-21\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next monday")) . " should be 2019-04-22\n\n"; echo "works as expected:\n"; echo date("Y-m-d H:i:s", strtotime("2019-04-15 next monday")) . " should be 2019-04-22\n"; echo date("Y-m-d H:i:s", strtotime("2019-04-15 next friday")) . " should be 2019-04-19\n"; echo date("Y-m-d H:i:s", strtotime("2019-04-15 next thursday")) . " should be 2019-04-18\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oJ5aQ
function name:  (null)
number of ops:  124
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'UTC'
          2        DO_ICALL                                                 
    4     3        ECHO                                                     'works+as+expected%3A%0A'
    5     4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          6        INIT_FCALL                                               'strtotime'
          7        SEND_VAL                                                 '2019W14'
          8        DO_ICALL                                         $1      
          9        SEND_VAR                                                 $1
         10        DO_ICALL                                         $2      
         11        CONCAT                                           ~3      $2, '+should+be+2019-04-01%0A'
         12        ECHO                                                     ~3
    6    13        INIT_FCALL                                               'date'
         14        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         15        INIT_FCALL                                               'strtotime'
         16        SEND_VAL                                                 '2019W15'
         17        DO_ICALL                                         $4      
         18        SEND_VAR                                                 $4
         19        DO_ICALL                                         $5      
         20        CONCAT                                           ~6      $5, '+should+be+2019-04-08%0A'
         21        ECHO                                                     ~6
    7    22        INIT_FCALL                                               'date'
         23        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         24        INIT_FCALL                                               'strtotime'
         25        SEND_VAL                                                 '2019W16'
         26        DO_ICALL                                         $7      
         27        SEND_VAR                                                 $7
         28        DO_ICALL                                         $8      
         29        CONCAT                                           ~9      $8, '+should+be+2019-04-15%0A%0A'
         30        ECHO                                                     ~9
    9    31        ECHO                                                     'off+by+one%3A%0A'
   10    32        INIT_FCALL                                               'date'
         33        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         34        INIT_FCALL                                               'strtotime'
         35        SEND_VAL                                                 '2019W16+next+tuesday'
         36        DO_ICALL                                         $10     
         37        SEND_VAR                                                 $10
         38        DO_ICALL                                         $11     
         39        CONCAT                                           ~12     $11, '+should+be+2019-04-16%0A'
         40        ECHO                                                     ~12
   11    41        INIT_FCALL                                               'date'
         42        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         43        INIT_FCALL                                               'strtotime'
         44        SEND_VAL                                                 '2019W16+next+wednesday'
         45        DO_ICALL                                         $13     
         46        SEND_VAR                                                 $13
         47        DO_ICALL                                         $14     
         48        CONCAT                                           ~15     $14, '+should+be+2019-04-17%0A'
         49        ECHO                                                     ~15
   12    50        INIT_FCALL                                               'date'
         51        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         52        INIT_FCALL                                               'strtotime'
         53        SEND_VAL                                                 '2019W16+next+thursday'
         54        DO_ICALL                                         $16     
         55        SEND_VAR                                                 $16
         56        DO_ICALL                                         $17     
         57        CONCAT                                           ~18     $17, '+should+be+2019-04-18%0A'
         58        ECHO                                                     ~18
   13    59        INIT_FCALL                                               'date'
         60        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         61        INIT_FCALL                                               'strtotime'
         62        SEND_VAL                                                 '2019W16+next+friday'
         63        DO_ICALL                                         $19     
         64        SEND_VAR                                                 $19
         65        DO_ICALL                                         $20     
         66        CONCAT                                           ~21     $20, '+should+be+2019-04-19%0A'
         67        ECHO                                                     ~21
   14    68        INIT_FCALL                                               'date'
         69        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         70        INIT_FCALL                                               'strtotime'
         71        SEND_VAL                                                 '2019W16+next+saturday'
         72        DO_ICALL                                         $22     
         73        SEND_VAR                                                 $22
         74        DO_ICALL                                         $23     
         75        CONCAT                                           ~24     $23, '+should+be+2019-04-20%0A'
         76        ECHO                                                     ~24
   15    77        INIT_FCALL                                               'date'
         78        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         79        INIT_FCALL                                               'strtotime'
         80        SEND_VAL                                                 '2019W16+next+sunday'
         81        DO_ICALL                                         $25     
         82        SEND_VAR                                                 $25
         83        DO_ICALL                                         $26     
         84        CONCAT                                           ~27     $26, '+should+be+2019-04-21%0A'
         85        ECHO                                                     ~27
   16    86        INIT_FCALL                                               'date'
         87        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         88        INIT_FCALL                                               'strtotime'
         89        SEND_VAL                                                 '2019W16+next+monday'
         90        DO_ICALL                                         $28     
         91        SEND_VAR                                                 $28
         92        DO_ICALL                                         $29     
         93        CONCAT                                           ~30     $29, '+should+be+2019-04-22%0A%0A'
         94        ECHO                                                     ~30
   18    95        ECHO                                                     'works+as+expected%3A%0A'
   19    96        INIT_FCALL                                               'date'
         97        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         98        INIT_FCALL                                               'strtotime'
         99        SEND_VAL                                                 '2019-04-15+next+monday'
        100        DO_ICALL                                         $31     
        101        SEND_VAR                                                 $31
        102        DO_ICALL                                         $32     
        103        CONCAT                                           ~33     $32, '+should+be+2019-04-22%0A'
        104        ECHO                                                     ~33
   20   105        INIT_FCALL                                               'date'
        106        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
        107        INIT_FCALL                                               'strtotime'
        108        SEND_VAL                                                 '2019-04-15+next+friday'
        109        DO_ICALL                                         $34     
        110        SEND_VAR                                                 $34
        111        DO_ICALL                                         $35     
        112        CONCAT                                           ~36     $35, '+should+be+2019-04-19%0A'
        113        ECHO                                                     ~36
   21   114        INIT_FCALL                                               'date'
        115        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
        116        INIT_FCALL                                               'strtotime'
        117        SEND_VAL                                                 '2019-04-15+next+thursday'
        118        DO_ICALL                                         $37     
        119        SEND_VAR                                                 $37
        120        DO_ICALL                                         $38     
        121        CONCAT                                           ~39     $38, '+should+be+2019-04-18%0A'
        122        ECHO                                                     ~39
        123      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.44 ms | 1409 KiB | 19 Q