3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface A {} interface B {} class Implementation { function foo(A|null $param) { throw new Exception(); } function bar(A|B|null $param) { throw new Exception(); } } var_dump((new ReflectionParameter([Implementation::class, 'foo'], 0))->getType()); var_dump((new ReflectionParameter([Implementation::class, 'bar'], 0))->getType());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gMA4T
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'var_dump'
          1        NEW                                              $0      'ReflectionParameter'
          2        SEND_VAL_EX                                              <array>
          3        SEND_VAL_EX                                              0
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         $0, 'getType'
          6        DO_FCALL                                      0  $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                                 
   13     9        INIT_FCALL                                               'var_dump'
         10        NEW                                              $4      'ReflectionParameter'
         11        SEND_VAL_EX                                              <array>
         12        SEND_VAL_EX                                              0
         13        DO_FCALL                                      0          
         14        INIT_METHOD_CALL                                         $4, 'getType'
         15        DO_FCALL                                      0  $6      
         16        SEND_VAR                                                 $6
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class A: [no user functions]
Class B: [no user functions]
Class Implementation:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/gMA4T
function name:  foo
number of ops:  5
compiled vars:  !0 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        NEW                                              $1      'Exception'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $1
          4*     > RETURN                                                   null

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/gMA4T
function name:  bar
number of ops:  5
compiled vars:  !0 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        NEW                                              $1      'Exception'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $1
          4*     > RETURN                                                   null

End of function bar

End of class Implementation.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.82 ms | 1011 KiB | 14 Q