3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct(int $j) { } } class Bar extends Foo { public function __construct(string $j) { } } $ref = new \ReflectionClass(\Bar::class); var_dump($ref->getMethod('__construct')->getPrototype()->getDeclaringClass()->getName());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qFS4F
function name:  (null)
number of ops:  17
compiled vars:  !0 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'ReflectionClass'
          1        SEND_VAL_EX                                              'Bar'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   24     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'getMethod'
          6        SEND_VAL_EX                                              '__construct'
          7        DO_FCALL                                      0  $4      
          8        INIT_METHOD_CALL                                         $4, 'getPrototype'
          9        DO_FCALL                                      0  $5      
         10        INIT_METHOD_CALL                                         $5, 'getDeclaringClass'
         11        DO_FCALL                                      0  $6      
         12        INIT_METHOD_CALL                                         $6, 'getName'
         13        DO_FCALL                                      0  $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qFS4F
function name:  __construct
number of ops:  2
compiled vars:  !0 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    9     1      > RETURN                                                   null

End of function __construct

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qFS4F
function name:  __construct
number of ops:  2
compiled vars:  !0 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   19     1      > RETURN                                                   null

End of function __construct

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.51 ms | 1395 KiB | 15 Q