3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function foo(): ?int { return 1; } public function baz() { return 2; } } $foo = new ReflectionMethod((new A), "foo"); $baz = new ReflectionMethod((new A), "baz"); echo "foo: " . $foo->getReturnType(); echo "\n"; echo "baz: " . $baz->getReturnType();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8sEIJ
function name:  (null)
number of ops:  24
compiled vars:  !0 = $foo, !1 = $baz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $2      'ReflectionMethod'
          1        NEW                                              $3      'A'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $3
          4        SEND_VAL_EX                                              'foo'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   12     7        NEW                                              $7      'ReflectionMethod'
          8        NEW                                              $8      'A'
          9        DO_FCALL                                      0          
         10        SEND_VAR_NO_REF_EX                                       $8
         11        SEND_VAL_EX                                              'baz'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !1, $7
   14    14        INIT_METHOD_CALL                                         !0, 'getReturnType'
         15        DO_FCALL                                      0  $12     
         16        CONCAT                                           ~13     'foo%3A+', $12
         17        ECHO                                                     ~13
   15    18        ECHO                                                     '%0A'
   16    19        INIT_METHOD_CALL                                         !1, 'getReturnType'
         20        DO_FCALL                                      0  $14     
         21        CONCAT                                           ~15     'baz%3A+', $14
         22        ECHO                                                     ~15
         23      > RETURN                                                   1

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

End of function foo

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

End of function baz

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.84 ms | 1434 KiB | 13 Q