3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time = DateTimeImmutable::createFromFormat('U e', '1730597400 America/Toronto'); var_dump($time, $time->getTimestamp(), $time->format('U')); echo PHP_EOL; $date = new DateTimeImmutable('@1730597400', new DateTimeZone('America/Toronto')); var_Dump($date, $date->getTimestamp()); echo PHP_EOL; $date = DateTime::createFromFormat('U', '1730597400'); $date->setTimezone(new DateTimeZone('America/Toronto')); var_Dump($date, $date->getTimestamp());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KugCQ
function name:  (null)
number of ops:  49
compiled vars:  !0 = $time, !1 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_STATIC_METHOD_CALL                                  'DateTimeImmutable', 'createFromFormat'
          1        SEND_VAL                                                 'U+e'
          2        SEND_VAL                                                 '1730597400+America%2FToronto'
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !0, $2
    4     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        INIT_METHOD_CALL                                         !0, 'getTimestamp'
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR                                                 $4
         10        INIT_METHOD_CALL                                         !0, 'format'
         11        SEND_VAL_EX                                              'U'
         12        DO_FCALL                                      0  $5      
         13        SEND_VAR                                                 $5
         14        DO_ICALL                                                 
    6    15        ECHO                                                     '%0A'
    7    16        NEW                                              $7      'DateTimeImmutable'
         17        SEND_VAL_EX                                              '%401730597400'
         18        NEW                                              $8      'DateTimeZone'
         19        SEND_VAL_EX                                              'America%2FToronto'
         20        DO_FCALL                                      0          
         21        SEND_VAR_NO_REF_EX                                       $8
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !1, $7
    9    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !1
         26        INIT_METHOD_CALL                                         !1, 'getTimestamp'
         27        DO_FCALL                                      0  $12     
         28        SEND_VAR                                                 $12
         29        DO_ICALL                                                 
   10    30        ECHO                                                     '%0A'
   12    31        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         32        SEND_VAL                                                 'U'
         33        SEND_VAL                                                 '1730597400'
         34        DO_FCALL                                      0  $14     
         35        ASSIGN                                                   !1, $14
   13    36        INIT_METHOD_CALL                                         !1, 'setTimezone'
         37        NEW                                              $16     'DateTimeZone'
         38        SEND_VAL_EX                                              'America%2FToronto'
         39        DO_FCALL                                      0          
         40        SEND_VAR_NO_REF_EX                                       $16
         41        DO_FCALL                                      0          
   15    42        INIT_FCALL                                               'var_dump'
         43        SEND_VAR                                                 !1
         44        INIT_METHOD_CALL                                         !1, 'getTimestamp'
         45        DO_FCALL                                      0  $19     
         46        SEND_VAR                                                 $19
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.67 ms | 1441 KiB | 14 Q