3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_timezone_from_offset(int $offset): \DateTimeZone { $isAbs = $offset >= 0; $offset = abs($offset); $offset = number_format($offset / 60 / 60, 2, ' ', ''); #$offset = str_pad($offset, 4, '0', STR_PAD_LEFT); #$offset = $isAbs ? '+'.$offset : '-'.$offset; dump($offset); die; return new \DateTimeZone($offset); } var_dump(get_timezone_from_offset(-7200));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5Nmjm
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'get_timezone_from_offset'
          2        SEND_VAL                                                 -7200
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function get_timezone_from_offset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/5Nmjm
function name:  get_timezone_from_offset
number of ops:  27
compiled vars:  !0 = $offset, !1 = $isAbs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        IS_SMALLER_OR_EQUAL                              ~2      0, !0
          2        ASSIGN                                                   !1, ~2
    5     3        INIT_FCALL                                               'abs'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !0, $4
    6     7        INIT_FCALL                                               'number_format'
          8        DIV                                              ~6      !0, 60
          9        DIV                                              ~7      ~6, 60
         10        SEND_VAL                                                 ~7
         11        SEND_VAL                                                 2
         12        SEND_VAL                                                 '+'
         13        SEND_VAL                                                 ''
         14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !0, $8
   10    16        INIT_FCALL_BY_NAME                                       'dump'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0          
   11    19      > EXIT                                                     
   13    20*       NEW                                              $11     'DateTimeZone'
         21*       SEND_VAR_EX                                              !0
         22*       DO_FCALL                                      0          
         23*       VERIFY_RETURN_TYPE                                       $11
         24*       RETURN                                                   $11
   14    25*       VERIFY_RETURN_TYPE                                       
         26*     > RETURN                                                   null

End of function get_timezone_from_offset

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.42 ms | 1399 KiB | 20 Q