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 = $offset / 60 / 60; $offset = str_pad($offset, 4, '0',STR_PAD_LEFT); $offset = $isAbs ? '+'.$offset : '-'.$offset; 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/4TnsB
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     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
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 21
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4TnsB
function name:  get_timezone_from_offset
number of ops:  31
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        DIV                                              ~6      !0, 60
          8        DIV                                              ~7      ~6, 60
          9        ASSIGN                                                   !0, ~7
    7    10        INIT_FCALL                                               'str_pad'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 4
         13        SEND_VAL                                                 '0'
         14        SEND_VAL                                                 0
         15        DO_ICALL                                         $9      
         16        ASSIGN                                                   !0, $9
    8    17      > JMPZ                                                     !1, ->21
         18    >   CONCAT                                           ~11     '%2B', !0
         19        QM_ASSIGN                                        ~12     ~11
         20      > JMP                                                      ->23
         21    >   CONCAT                                           ~13     '-', !0
         22        QM_ASSIGN                                        ~12     ~13
         23    >   ASSIGN                                                   !0, ~12
   10    24        NEW                                              $15     'DateTimeZone'
         25        SEND_VAR_EX                                              !0
         26        DO_FCALL                                      0          
         27        VERIFY_RETURN_TYPE                                       $15
         28      > RETURN                                                   $15
   11    29*       VERIFY_RETURN_TYPE                                       
         30*     > RETURN                                                   null

End of function get_timezone_from_offset

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.82 ms | 1403 KiB | 20 Q