3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getStandardOffsetFromUTC($timezone) { $timezone = new DateTimeZone($timezone); $transitions = array_slice($timezone->getTransitions(), -3); foreach (array_reverse($transitions) as $transition) { if ($transition['isdst'] == 1) // we are interested in standard offsets only { continue; } return sprintf('UTC %+03d:%02u', $transition['offset'] / 3600, abs($transition['offset']) % 3600 / 60); } return false; } echo getStandardOffsetFromUTC('America/Argentina/San_Luis') . "\n"; echo getStandardOffsetFromUTC('Antarctica/Casey') . "\n"; echo getStandardOffsetFromUTC('Antarctica/Davis') . "\n"; echo timezone_version_get(), "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZHfTQ
function name:  (null)
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'getstandardoffsetfromutc'
          1        SEND_VAL                                                 'America%2FArgentina%2FSan_Luis'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      $0, '%0A'
          4        ECHO                                                     ~1
   22     5        INIT_FCALL                                               'getstandardoffsetfromutc'
          6        SEND_VAL                                                 'Antarctica%2FCasey'
          7        DO_FCALL                                      0  $2      
          8        CONCAT                                           ~3      $2, '%0A'
          9        ECHO                                                     ~3
   23    10        INIT_FCALL                                               'getstandardoffsetfromutc'
         11        SEND_VAL                                                 'Antarctica%2FDavis'
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '%0A'
         14        ECHO                                                     ~5
   25    15        INIT_FCALL                                               'timezone_version_get'
         16        DO_ICALL                                         $6      
         17        ECHO                                                     $6
         18        ECHO                                                     '%0A'
         19      > RETURN                                                   1

Function getstandardoffsetfromutc:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 37
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 37
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/ZHfTQ
function name:  getStandardOffsetFromUTC
number of ops:  40
compiled vars:  !0 = $timezone, !1 = $transitions, !2 = $transition
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        NEW                                              $3      'DateTimeZone'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
    6     5        INIT_FCALL                                               'array_slice'
          6        INIT_METHOD_CALL                                         !0, 'getTransitions'
          7        DO_FCALL                                      0  $6      
          8        SEND_VAR                                                 $6
          9        SEND_VAL                                                 -3
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !1, $7
    8    12        INIT_FCALL                                               'array_reverse'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $9      
         15      > FE_RESET_R                                       $10     $9, ->37
         16    > > FE_FETCH_R                                               $10, !2, ->37
   10    17    >   FETCH_DIM_R                                      ~11     !2, 'isdst'
         18        IS_EQUAL                                                 ~11, 1
         19      > JMPZ                                                     ~12, ->21
   12    20    > > JMP                                                      ->16
   15    21    >   INIT_FCALL                                               'sprintf'
         22        SEND_VAL                                                 'UTC+%25%2B03d%3A%2502u'
         23        FETCH_DIM_R                                      ~13     !2, 'offset'
         24        DIV                                              ~14     ~13, 3600
         25        SEND_VAL                                                 ~14
         26        INIT_FCALL                                               'abs'
         27        FETCH_DIM_R                                      ~15     !2, 'offset'
         28        SEND_VAL                                                 ~15
         29        DO_ICALL                                         $16     
         30        MOD                                              ~17     $16, 3600
         31        DIV                                              ~18     ~17, 60
         32        SEND_VAL                                                 ~18
         33        DO_ICALL                                         $19     
         34        FE_FREE                                                  $10
         35      > RETURN                                                   $19
    8    36*       JMP                                                      ->16
         37    >   FE_FREE                                                  $10
   18    38      > RETURN                                                   <false>
   19    39*     > RETURN                                                   null

End of function getstandardoffsetfromutc

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.81 ms | 1403 KiB | 26 Q