3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'date_default_timezone_get(): ' . print_r(date_default_timezone_get(), true) . "\n"; $ts = time(); echo '$ts: ' . print_r($ts, true) . "\n"; echo 'date(\'c\', $ts): ' . print_r(date('c', $ts), true) . "\n"; $datetime = new \Datetime(date('c', $ts)); echo '$datetime: ' . print_r($datetime, true) . "\n"; $datetime = new \Datetime('@' . $ts); echo '$datetime: ' . print_r($datetime, true) . "\n"; $datetime = new \Datetime('@' . $ts); $datetime->setTimezone(new \DateTimeZone(date_default_timezone_get())); echo '$datetime: ' . print_r($datetime, true) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y51mk
function name:  (null)
number of ops:  78
compiled vars:  !0 = $ts, !1 = $datetime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL                                               'date_default_timezone_get'
          2        DO_ICALL                                         $2      
          3        SEND_VAR                                                 $2
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $3      
          6        CONCAT                                           ~4      'date_default_timezone_get%28%29%3A+', $3
          7        CONCAT                                           ~5      ~4, '%0A'
          8        ECHO                                                     ~5
    5     9        INIT_FCALL                                               'time'
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !0, $6
    6    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $8      
         16        CONCAT                                           ~9      '%24ts%3A+', $8
         17        CONCAT                                           ~10     ~9, '%0A'
         18        ECHO                                                     ~10
    8    19        INIT_FCALL                                               'print_r'
         20        INIT_FCALL                                               'date'
         21        SEND_VAL                                                 'c'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $11     
         24        SEND_VAR                                                 $11
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $12     
         27        CONCAT                                           ~13     'date%28%27c%27%2C+%24ts%29%3A+', $12
         28        CONCAT                                           ~14     ~13, '%0A'
         29        ECHO                                                     ~14
   10    30        NEW                                              $15     'Datetime'
         31        INIT_FCALL                                               'date'
         32        SEND_VAL                                                 'c'
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                         $16     
         35        SEND_VAR_NO_REF_EX                                       $16
         36        DO_FCALL                                      0          
         37        ASSIGN                                                   !1, $15
   11    38        INIT_FCALL                                               'print_r'
         39        SEND_VAR                                                 !1
         40        SEND_VAL                                                 <true>
         41        DO_ICALL                                         $19     
         42        CONCAT                                           ~20     '%24datetime%3A+', $19
         43        CONCAT                                           ~21     ~20, '%0A'
         44        ECHO                                                     ~21
   13    45        NEW                                              $22     'Datetime'
         46        CONCAT                                           ~23     '%40', !0
         47        SEND_VAL_EX                                              ~23
         48        DO_FCALL                                      0          
         49        ASSIGN                                                   !1, $22
   14    50        INIT_FCALL                                               'print_r'
         51        SEND_VAR                                                 !1
         52        SEND_VAL                                                 <true>
         53        DO_ICALL                                         $26     
         54        CONCAT                                           ~27     '%24datetime%3A+', $26
         55        CONCAT                                           ~28     ~27, '%0A'
         56        ECHO                                                     ~28
   16    57        NEW                                              $29     'Datetime'
         58        CONCAT                                           ~30     '%40', !0
         59        SEND_VAL_EX                                              ~30
         60        DO_FCALL                                      0          
         61        ASSIGN                                                   !1, $29
   17    62        INIT_METHOD_CALL                                         !1, 'setTimezone'
         63        NEW                                              $33     'DateTimeZone'
         64        INIT_FCALL                                               'date_default_timezone_get'
         65        DO_ICALL                                         $34     
         66        SEND_VAR_NO_REF_EX                                       $34
         67        DO_FCALL                                      0          
         68        SEND_VAR_NO_REF_EX                                       $33
         69        DO_FCALL                                      0          
   18    70        INIT_FCALL                                               'print_r'
         71        SEND_VAR                                                 !1
         72        SEND_VAL                                                 <true>
         73        DO_ICALL                                         $37     
         74        CONCAT                                           ~38     '%24datetime%3A+', $37
         75        CONCAT                                           ~39     ~38, '%0A'
         76        ECHO                                                     ~39
         77      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
129.42 ms | 1461 KiB | 17 Q