3v4l.org

run code in 500+ PHP versions simultaneously
<?php function getTZType(\DateTime $date) { ob_start(); var_export($date); $dateString = ob_get_clean(); preg_match('%=>.\d%', $dateString, $matches); return (int)explode(' ', $matches[0])[1]; } $date = new \DateTime('2014-01-13 04:22 -8'); echo getTZType($date) . "\n"; $date = new \DateTime('2014-01-13 04:22'); echo getTZType($date);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tOmZL
function name:  (null)
number of ops:  18
compiled vars:  !0 = $date
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   NEW                                                  $1      'DateTime'
          1        SEND_VAL_EX                                                  '2014-01-13+04%3A22+-8'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   12     4        INIT_FCALL                                                   'gettztype'
          5        SEND_VAR                                                     !0
          6        DO_FCALL                                          0  $4      
          7        CONCAT                                               ~5      $4, '%0A'
          8        ECHO                                                         ~5
   14     9        NEW                                                  $6      'DateTime'
         10        SEND_VAL_EX                                                  '2014-01-13+04%3A22'
         11        DO_FCALL                                          0          
         12        ASSIGN                                                       !0, $6
   15    13        INIT_FCALL                                                   'gettztype'
         14        SEND_VAR                                                     !0
         15        DO_FCALL                                          0  $9      
         16        ECHO                                                         $9
         17      > RETURN                                                       1

Function gettztype:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tOmZL
function name:  getTZType
number of ops:  23
compiled vars:  !0 = $date, !1 = $dateString, !2 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   RECV                                                 !0      
    4     1        INIT_FCALL                                                   'ob_start'
          2        DO_ICALL                                                     
    5     3        INIT_FCALL                                                   'var_export'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                                     
    6     6        INIT_FCALL                                                   'ob_get_clean'
          7        DO_ICALL                                             $5      
          8        ASSIGN                                                       !1, $5
    7     9        INIT_FCALL                                                   'preg_match'
         10        SEND_VAL                                                     '%25%3D%3E.%5Cd%25'
         11        SEND_VAR                                                     !1
         12        SEND_REF                                                     !2
         13        DO_ICALL                                                     
    8    14        INIT_FCALL                                                   'explode'
         15        SEND_VAL                                                     '+'
         16        FETCH_DIM_R                                          ~8      !2, 0
         17        SEND_VAL                                                     ~8
         18        DO_ICALL                                             $9      
         19        FETCH_DIM_R                                          ~10     $9, 1
         20        CAST                                              4  ~11     ~10
         21      > RETURN                                                       ~11
    9    22*     > RETURN                                                       null

End of function gettztype

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
176.32 ms | 2925 KiB | 19 Q