3v4l.org

run code in 300+ PHP versions simultaneously
<?php $offset = "12:00 pm"; $plus_hours = 0; if (strlen($offset) > 5) { list($offset, $apm) = explode(" ", $offset); if (strtoupper($apm) == "PM"){ $plus_hours = 12; } } $temp = explode(':', $offset); $offset_hours = $temp[0] + $plus_hours; $offset_minutes = $temp[1]; $dt = new DateInterval('PT' . $offset_hours . 'H' . $offset_minutes . 'M'); echo $dt->h; print_r($dt);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 20
filename:       /in/UJjZA
function name:  (null)
number of ops:  44
compiled vars:  !0 = $offset, !1 = $plus_hours, !2 = $apm, !3 = $temp, !4 = $offset_hours, !5 = $offset_minutes, !6 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '12%3A00+pm'
    3     1        ASSIGN                                                   !1, 0
    4     2        STRLEN                                           ~9      !0
          3        IS_SMALLER                                               5, ~9
          4      > JMPZ                                                     ~10, ->20
    6     5    >   INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '+'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $11     
          9        FETCH_LIST_R                                     $12     $11, 0
         10        ASSIGN                                                   !0, $12
         11        FETCH_LIST_R                                     $14     $11, 1
         12        ASSIGN                                                   !2, $14
         13        FREE                                                     $11
    7    14        INIT_FCALL                                               'strtoupper'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $16     
         17        IS_EQUAL                                                 $16, 'PM'
         18      > JMPZ                                                     ~17, ->20
    8    19    >   ASSIGN                                                   !1, 12
   11    20    >   INIT_FCALL                                               'explode'
         21        SEND_VAL                                                 '%3A'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $19     
         24        ASSIGN                                                   !3, $19
   12    25        FETCH_DIM_R                                      ~21     !3, 0
         26        ADD                                              ~22     ~21, !1
         27        ASSIGN                                                   !4, ~22
   13    28        FETCH_DIM_R                                      ~24     !3, 1
         29        ASSIGN                                                   !5, ~24
   15    30        NEW                                              $26     'DateInterval'
         31        CONCAT                                           ~27     'PT', !4
         32        CONCAT                                           ~28     ~27, 'H'
         33        CONCAT                                           ~29     ~28, !5
         34        CONCAT                                           ~30     ~29, 'M'
         35        SEND_VAL_EX                                              ~30
         36        DO_FCALL                                      0          
         37        ASSIGN                                                   !6, $26
   16    38        FETCH_OBJ_R                                      ~33     !6, 'h'
         39        ECHO                                                     ~33
   17    40        INIT_FCALL                                               'print_r'
         41        SEND_VAR                                                 !6
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.75 ms | 1392 KiB | 19 Q