3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Europe/London'); $format = 'Y-m-d H:i e'; $times = array( '2015-10-24 15:00:00 01:00:00 BST', '2015-10-25 15:00:00 01:00:00 BST', '2015-10-26 15:00:00 01:00:00 BST' ); foreach ($times as $time) { $dt = DateTime::createFromFormat('Y-m-d H:i:s T', $time, new DateTimeZone('Europe/London')); echo "Localised:\n"; echo $dt->format($format) . "\n\n"; echo "Putting into UTC:\n"; $dt->setTimezone(new DateTimeZone('UTC')); echo $dt->format($format) . "\n\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 35
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 35
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/j8F9R
function name:  (null)
number of ops:  37
compiled vars:  !0 = $format, !1 = $times, !2 = $time, !3 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'Europe%2FLondon'
          2        DO_ICALL                                                 
    4     3        ASSIGN                                                   !0, 'Y-m-d+H%3Ai+e'
    6     4        ASSIGN                                                   !1, <array>
   12     5      > FE_RESET_R                                       $7      !1, ->35
          6    > > FE_FETCH_R                                               $7, !2, ->35
   13     7    >   INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          8        SEND_VAL                                                 'Y-m-d+H%3Ai%3As+T'
          9        SEND_VAR                                                 !2
         10        NEW                                              $8      'DateTimeZone'
         11        SEND_VAL_EX                                              'Europe%2FLondon'
         12        DO_FCALL                                      0          
         13        SEND_VAR                                                 $8
         14        DO_FCALL                                      0  $10     
         15        ASSIGN                                                   !3, $10
   15    16        ECHO                                                     'Localised%3A%0A'
   16    17        INIT_METHOD_CALL                                         !3, 'format'
         18        SEND_VAR_EX                                              !0
         19        DO_FCALL                                      0  $12     
         20        CONCAT                                           ~13     $12, '%0A%0A'
         21        ECHO                                                     ~13
   18    22        ECHO                                                     'Putting+into+UTC%3A%0A'
   19    23        INIT_METHOD_CALL                                         !3, 'setTimezone'
         24        NEW                                              $14     'DateTimeZone'
         25        SEND_VAL_EX                                              'UTC'
         26        DO_FCALL                                      0          
         27        SEND_VAR_NO_REF_EX                                       $14
         28        DO_FCALL                                      0          
   20    29        INIT_METHOD_CALL                                         !3, 'format'
         30        SEND_VAR_EX                                              !0
         31        DO_FCALL                                      0  $17     
         32        CONCAT                                           ~18     $17, '%0A%0A'
         33        ECHO                                                     ~18
   12    34      > JMP                                                      ->6
         35    >   FE_FREE                                                  $7
   21    36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.85 ms | 1396 KiB | 15 Q