3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dates = array( '2019-03-02 20:00:00', '2019-03-05 20:00:00', '2019-03-10 20:00:00', '2019-03-18 20:00:00'); $west_coast = new DateTimeZone('Etc/GMT+8'); foreach ($dates as $date) { $dt = new DateTime($date, new DateTimeZone('UTC')); $dt->setTimeZone($west_coast); echo $dt->format('Y-m-d H:i:s') . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 24
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 24
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/lOkBC
function name:  (null)
number of ops:  26
compiled vars:  !0 = $dates, !1 = $west_coast, !2 = $date, !3 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1        NEW                                              $5      'DateTimeZone'
          2        SEND_VAL_EX                                              'Etc%2FGMT%2B8'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
    9     5      > FE_RESET_R                                       $8      !0, ->24
          6    > > FE_FETCH_R                                               $8, !2, ->24
   10     7    >   NEW                                              $9      'DateTime'
          8        SEND_VAR_EX                                              !2
          9        NEW                                              $10     'DateTimeZone'
         10        SEND_VAL_EX                                              'UTC'
         11        DO_FCALL                                      0          
         12        SEND_VAR_NO_REF_EX                                       $10
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !3, $9
   11    15        INIT_METHOD_CALL                                         !3, 'setTimeZone'
         16        SEND_VAR_EX                                              !1
         17        DO_FCALL                                      0          
   12    18        INIT_METHOD_CALL                                         !3, 'format'
         19        SEND_VAL_EX                                              'Y-m-d+H%3Ai%3As'
         20        DO_FCALL                                      0  $15     
         21        CONCAT                                           ~16     $15, '%0A'
         22        ECHO                                                     ~16
    9    23      > JMP                                                      ->6
         24    >   FE_FREE                                                  $8
   13    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
128.07 ms | 1398 KiB | 13 Q