3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime('2015-01-15 15:00:00'); var_dump($date); $date->setTimezone(new DateTimeZone('CET')); echo "\n Date timestamp using format(): " . $date->format('U'); echo "\n Date timestamp using getTimestamp(): " . $date->getTimestamp(); echo "\nChanging timezone to CET"; $date->setTimezone(new DateTimeZone('CET')); echo "\n Date timestamp using format(): " . $date->format('U') . ' NB: This has changed?!?!'; echo "\n Date timestamp using getTimestamp(): " . $date->getTimestamp() . ' NB: Now it is back?!?!'; echo "\n Date timestamp using format() again: " . $date->format('U') . ' NB: Now it is back?!?!';
based on JhmZF
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7XlWC
function name:  (null)
number of ops:  47
compiled vars:  !0 = $date
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NEW                                              $1      :-5
         1        SEND_VAL_EX                                              '2015-01-15+15%3A00%3A00'
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $1
   3     4        INIT_FCALL                                               'var_dump'
         5        SEND_VAR                                                 !0
         6        DO_ICALL                                                 
   4     7        INIT_METHOD_CALL                                         !0, 'setTimezone'
         8        NEW                                              $5      :1
         9        SEND_VAL_EX                                              'CET'
        10        DO_FCALL                                      0          
        11        SEND_VAR_NO_REF_EX                                       $5
        12        DO_FCALL                                      0          
   5    13        INIT_METHOD_CALL                                         !0, 'format'
        14        SEND_VAL_EX                                              'U'
        15        DO_FCALL                                      0  $8      
        16        CONCAT                                           ~9      '%0A+Date+timestamp+using+format%28%29%3A+++++++', $8
        17        ECHO                                                     ~9
   6    18        INIT_METHOD_CALL                                         !0, 'getTimestamp'
        19        DO_FCALL                                      0  $10     
        20        CONCAT                                           ~11     '%0A+Date+timestamp+using+getTimestamp%28%29%3A+', $10
        21        ECHO                                                     ~11
   8    22        ECHO                                                     '%0AChanging+timezone+to+CET'
   9    23        INIT_METHOD_CALL                                         !0, 'setTimezone'
        24        NEW                                              $12     :14
        25        SEND_VAL_EX                                              'CET'
        26        DO_FCALL                                      0          
        27        SEND_VAR_NO_REF_EX                                       $12
        28        DO_FCALL                                      0          
  11    29        INIT_METHOD_CALL                                         !0, 'format'
        30        SEND_VAL_EX                                              'U'
        31        DO_FCALL                                      0  $15     
        32        CONCAT                                           ~16     '%0A+Date+timestamp+using+format%28%29%3A+++++++', $15
        33        CONCAT                                           ~17     ~16, '+NB%3A+This+has+changed%3F%21%3F%21'
        34        ECHO                                                     ~17
  12    35        INIT_METHOD_CALL                                         !0, 'getTimestamp'
        36        DO_FCALL                                      0  $18     
        37        CONCAT                                           ~19     '%0A+Date+timestamp+using+getTimestamp%28%29%3A+', $18
        38        CONCAT                                           ~20     ~19, '+NB%3A+Now+it+is+back%3F%21%3F%21'
        39        ECHO                                                     ~20
  13    40        INIT_METHOD_CALL                                         !0, 'format'
        41        SEND_VAL_EX                                              'U'
        42        DO_FCALL                                      0  $21     
        43        CONCAT                                           ~22     '%0A+Date+timestamp+using+format%28%29+again%3A+', $21
        44        CONCAT                                           ~23     ~22, '+NB%3A+Now+it+is+back%3F%21%3F%21'
        45        ECHO                                                     ~23
        46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0