3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace NS; class A { public function get($a){} } function foo($a = 'foo') { } $class = new \ReflectionClass('NS\A'); $method = $class->getMethod('get'); $parameters = $method->getParameters(); $aParameter = $parameters[0]; $method = new \ReflectionFunction('NS\foo'); $parameters = $method->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()); */ var_dump($aParameter->getDefaultValue()); var_dump($aParameter->getDefaultValueConstantName());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBhkR
function name:  (null)
number of ops:  33
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
   17    13        NEW                                              $13     'ReflectionFunction'
         14        SEND_VAL_EX                                              'NS%5Cfoo'
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !1, $13
   18    17        INIT_METHOD_CALL                                         !1, 'getParameters'
         18        DO_FCALL                                      0  $16     
         19        ASSIGN                                                   !2, $16
   19    20        FETCH_DIM_R                                      ~18     !2, 0
         21        ASSIGN                                                   !3, ~18
   31    22        INIT_NS_FCALL_BY_NAME                                    'NS%5Cvar_dump'
         23        INIT_METHOD_CALL                                         !3, 'getDefaultValue'
         24        DO_FCALL                                      0  $20     
         25        SEND_VAR_NO_REF_EX                                       $20
         26        DO_FCALL                                      0          
   32    27        INIT_NS_FCALL_BY_NAME                                    'NS%5Cvar_dump'
         28        INIT_METHOD_CALL                                         !3, 'getDefaultValueConstantName'
         29        DO_FCALL                                      0  $22     
         30        SEND_VAR_NO_REF_EX                                       $22
         31        DO_FCALL                                      0          
         32      > RETURN                                                   1

Function ns%5Cfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBhkR
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_INIT                                        !0      'foo'
          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/nBhkR
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:
153.79 ms | 1392 KiB | 15 Q