3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A {} function test(): A|null {} $r = (new ReflectionFunction('test')) ->getReturnType(); var_dump($r::class); var_dump($r->allowsNull());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lM9NJ
function name:  (null)
number of ops:  16
compiled vars:  !0 = $r
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   NEW                                                  $1      'ReflectionFunction'
          1        SEND_VAL_EX                                                  'test'
          2        DO_FCALL                                          0          
    8     3        INIT_METHOD_CALL                                             $1, 'getReturnType'
          4        DO_FCALL                                          0  $3      
    7     5        ASSIGN                                                       !0, $3
   10     6        INIT_FCALL                                                   'var_dump'
          7        FETCH_CLASS_NAME                                     ~5      !0
          8        SEND_VAL                                                     ~5
          9        DO_ICALL                                                     
   11    10        INIT_FCALL                                                   'var_dump'
         11        INIT_METHOD_CALL                                             !0, 'allowsNull'
         12        DO_FCALL                                          0  $7      
         13        SEND_VAR                                                     $7
         14        DO_ICALL                                                     
         15      > RETURN                                                       1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lM9NJ
function name:  test
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   VERIFY_RETURN_TYPE                                           
          1      > RETURN                                                       null

End of function test

Class A: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.35 ms | 2003 KiB | 14 Q