3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A {} class B { public function __construct(A $a = null) { } public function test($a = null) { } } $r = new ReflectionMethod('B', 'test'); $p = $r->getParameters()[0]; var_dump($p->getName(), $p->allowsNull(), $p->getDefaultValue()); $r = new ReflectionMethod('B', '__construct'); $p = $r->getParameters()[0]; var_dump($p->getName(), $p->isDefaultValueConstant(), $p->allowsNull(), $p->getDefaultValue());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E5eF4
function name:  (null)
number of ops:  44
compiled vars:  !0 = $r, !1 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $2      'ReflectionMethod'
          1        SEND_VAL_EX                                              'B'
          2        SEND_VAL_EX                                              'test'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   15     5        INIT_METHOD_CALL                                         !0, 'getParameters'
          6        DO_FCALL                                      0  $5      
          7        FETCH_DIM_R                                      ~6      $5, 0
          8        ASSIGN                                                   !1, ~6
   16     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !1, 'getName'
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
         13        INIT_METHOD_CALL                                         !1, 'allowsNull'
         14        DO_FCALL                                      0  $9      
         15        SEND_VAR                                                 $9
         16        INIT_METHOD_CALL                                         !1, 'getDefaultValue'
         17        DO_FCALL                                      0  $10     
         18        SEND_VAR                                                 $10
         19        DO_ICALL                                                 
   18    20        NEW                                              $12     'ReflectionMethod'
         21        SEND_VAL_EX                                              'B'
         22        SEND_VAL_EX                                              '__construct'
         23        DO_FCALL                                      0          
         24        ASSIGN                                                   !0, $12
   19    25        INIT_METHOD_CALL                                         !0, 'getParameters'
         26        DO_FCALL                                      0  $15     
         27        FETCH_DIM_R                                      ~16     $15, 0
         28        ASSIGN                                                   !1, ~16
   20    29        INIT_FCALL                                               'var_dump'
         30        INIT_METHOD_CALL                                         !1, 'getName'
         31        DO_FCALL                                      0  $18     
         32        SEND_VAR                                                 $18
         33        INIT_METHOD_CALL                                         !1, 'isDefaultValueConstant'
         34        DO_FCALL                                      0  $19     
         35        SEND_VAR                                                 $19
         36        INIT_METHOD_CALL                                         !1, 'allowsNull'
         37        DO_FCALL                                      0  $20     
         38        SEND_VAR                                                 $20
         39        INIT_METHOD_CALL                                         !1, 'getDefaultValue'
         40        DO_FCALL                                      0  $21     
         41        SEND_VAR                                                 $21
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Class A: [no user functions]
Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E5eF4
function name:  __construct
number of ops:  2
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      null
    7     1      > RETURN                                                   null

End of function __construct

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

End of function test

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.96 ms | 1400 KiB | 15 Q