3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
211.16 ms | 1404 KiB | 21 Q