3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('UTC'); $utc = new DateTimeZone('UTC'); $time = DateTime::createFromFormat('Y-m-d H:i:s', '2014-05-19 11:30:00', $utc); foreach (array('UTC', 'Europe/London', 'BST', 'Etc/GMT+1', 'GMT+1', 'CEST', 'EST', 'GMT-5') as $abbr) { $local = clone $time; try { $zone = new DateTimeZone($abbr); $local->setTimezone(new DateTimeZone($abbr)); echo "{$abbr}: {$zone->getOffset($time)} {$local->format('H:i P')}", PHP_EOL; } catch (Exception $e) { echo "{$abbr}: ERROR - {$e->getMessage()}", PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 50
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 50
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
Found catch point at position: 41
Branch analysis from position: 41
2 jumps found. (Code = 107) Position 1 = 42, Position 2 = -2
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
filename:       /in/QpJYP
function name:  (null)
number of ops:  52
compiled vars:  !0 = $utc, !1 = $time, !2 = $abbr, !3 = $local, !4 = $zone, !5 = $e
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                                                 
    5     3        NEW                                              $7      'DateTimeZone'
          4        SEND_VAL_EX                                              'UTC'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $7
    6     7        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          8        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          9        SEND_VAL                                                 '2014-05-19+11%3A30%3A00'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !1, $10
    7    13      > FE_RESET_R                                       $12     <array>, ->50
         14    > > FE_FETCH_R                                               $12, !2, ->50
    8    15    >   CLONE                                            ~13     !1
         16        ASSIGN                                                   !3, ~13
   10    17        NEW                                              $15     'DateTimeZone'
         18        SEND_VAR_EX                                              !2
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !4, $15
   11    21        INIT_METHOD_CALL                                         !3, 'setTimezone'
         22        NEW                                              $18     'DateTimeZone'
         23        SEND_VAR_EX                                              !2
         24        DO_FCALL                                      0          
         25        SEND_VAR_NO_REF_EX                                       $18
         26        DO_FCALL                                      0          
   12    27        ROPE_INIT                                     5  ~24     !2
         28        ROPE_ADD                                      1  ~24     ~24, '%3A+'
         29        INIT_METHOD_CALL                                         !4, 'getOffset'
         30        SEND_VAR_EX                                              !1
         31        DO_FCALL                                      0  $21     
         32        ROPE_ADD                                      2  ~24     ~24, $21
         33        ROPE_ADD                                      3  ~24     ~24, '+'
         34        INIT_METHOD_CALL                                         !3, 'format'
         35        SEND_VAL_EX                                              'H%3Ai+P'
         36        DO_FCALL                                      0  $22     
         37        ROPE_END                                      4  ~23     ~24, $22
         38        ECHO                                                     ~23
         39        ECHO                                                     '%0A'
         40      > JMP                                                      ->49
   13    41  E > > CATCH                                       last         'Exception'
   14    42    >   ROPE_INIT                                     3  ~29     !2
         43        ROPE_ADD                                      1  ~29     ~29, '%3A+ERROR+-+'
         44        INIT_METHOD_CALL                                         !5, 'getMessage'
         45        DO_FCALL                                      0  $27     
         46        ROPE_END                                      2  ~28     ~29, $27
         47        ECHO                                                     ~28
         48        ECHO                                                     '%0A'
    7    49    > > JMP                                                      ->14
         50    >   FE_FREE                                                  $12
   16    51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.51 ms | 1400 KiB | 15 Q