3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace NS; class A { public function get($a){} } function foo(array $a) { } $class = new \ReflectionClass('NS\A'); $method = $class->getMethod('get'); $parameters = $method->getParameters(); $aParameter = $parameters[0]; /* $functionReflection = new ReflectionFunction('foo'); $parameters = $functionReflection->getParameters(); $aParameter = $parameters[0]; */ var_dump($class->getNamespaceName()); var_dump($class->getName()); var_dump($method->getNamespaceName()); var_dump($method->getName()); var_dump($aParameter->getName()); var_dump($aParameter->getDeclaringFunction()->getNamespaceName()); var_dump($aParameter->getDeclaringFunction()->getName());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QCeQf
function name:  (null)
number of ops:  53
compiled vars:  !0 = $class, !1 = $method, !2 = $parameters, !3 = $aParameter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $4      'ReflectionClass'
          1        SEND_VAL_EX                                              'NS%5CA'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
   13     4        INIT_METHOD_CALL                                         !0, 'getMethod'
          5        SEND_VAL_EX                                              'get'
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !1, $7
   14     8        INIT_METHOD_CALL                                         !1, 'getParameters'
          9        DO_FCALL                                      0  $9      
         10        ASSIGN                                                   !2, $9
   15    11        FETCH_DIM_R                                      ~11     !2, 0
         12        ASSIGN                                                   !3, ~11
   22    13        INIT_NS_FCALL_BY_NAME                                    'NS%5Cvar_dump'
         14        INIT_METHOD_CALL                                         !0, 'getNamespaceName'
         15        DO_FCALL                                      0  $13     
         16        SEND_VAR_NO_REF_EX                                       $13
         17        DO_FCALL                                      0          
   23    18        INIT_NS_FCALL_BY_NAME                                    'NS%5Cvar_dump'
         19        INIT_METHOD_CALL                                         !0, 'getName'
         20        DO_FCALL                                      0  $15     
         21        SEND_VAR_NO_REF_EX                                       $15
         22        DO_FCALL                                      0          
   24    23        INIT_NS_FCALL_BY_NAME                                    'NS%5Cvar_dump'
         24        INIT_METHOD_CALL                                         !1, 'getNamespaceName'
         25        DO_FCALL                                      0  $17     
         26        SEND_VAR_NO_REF_EX                                       $17
         27        DO_FCALL                                      0          
   25    28        INIT_NS_FCALL_BY_NAME                                    'NS%5Cvar_dump'
         29        INIT_METHOD_CALL                                         !1, 'getName'
         30        DO_FCALL                                      0  $19     
         31        SEND_VAR_NO_REF_EX                                       $19
         32        DO_FCALL                                      0          
   26    33        INIT_NS_FCALL_BY_NAME                                    'NS%5Cvar_dump'
         34        INIT_METHOD_CALL                                         !3, 'getName'
         35        DO_FCALL                                      0  $21     
         36        SEND_VAR_NO_REF_EX                                       $21
         37        DO_FCALL                                      0          
   27    38        INIT_NS_FCALL_BY_NAME                                    'NS%5Cvar_dump'
         39        INIT_METHOD_CALL                                         !3, 'getDeclaringFunction'
         40        DO_FCALL                                      0  $23     
         41        INIT_METHOD_CALL                                         $23, 'getNamespaceName'
         42        DO_FCALL                                      0  $24     
         43        SEND_VAR_NO_REF_EX                                       $24
         44        DO_FCALL                                      0          
   28    45        INIT_NS_FCALL_BY_NAME                                    'NS%5Cvar_dump'
         46        INIT_METHOD_CALL                                         !3, 'getDeclaringFunction'
         47        DO_FCALL                                      0  $26     
         48        INIT_METHOD_CALL                                         $26, 'getName'
         49        DO_FCALL                                      0  $27     
         50        SEND_VAR_NO_REF_EX                                       $27
         51        DO_FCALL                                      0          
         52      > RETURN                                                   1

Function ns%5Cfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QCeQf
function name:  NS\foo
number of ops:  2
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function ns%5Cfoo

Class NS\A:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QCeQf
function name:  get
number of ops:  2
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function get

End of class NS\A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.82 ms | 1392 KiB | 15 Q