3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); function toDateInterval(string $interval): DateInterval { if (false === ($res = DateInterval::createFromDateString($interval))) { throw new Exception('Invalid string.'); } return $res; } var_dump(toDateInterval('foobar'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPOmh
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                                               'todateinterval'
          2        SEND_VAL                                                 'foobar'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function todateinterval:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPOmh
function name:  toDateInterval
number of ops:  15
compiled vars:  !0 = $interval, !1 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                           ~3      !1, $2
          5        TYPE_CHECK                                    4          ~3
          6      > JMPZ                                                     ~4, ->11
    6     7    >   NEW                                              $5      'Exception'
          8        SEND_VAL_EX                                              'Invalid+string.'
          9        DO_FCALL                                      0          
         10      > THROW                                         0          $5
    9    11    >   VERIFY_RETURN_TYPE                                       !1
         12      > RETURN                                                   !1
   10    13*       VERIFY_RETURN_TYPE                                       
         14*     > RETURN                                                   null

End of function todateinterval

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.99 ms | 1000 KiB | 15 Q