3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A {} class B { public function __construct(A $a = null) { } } $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/jiepI
function name:  (null)
number of ops:  24
compiled vars:  !0 = $r, !1 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $2      'ReflectionMethod'
          1        SEND_VAL_EX                                              'B'
          2        SEND_VAL_EX                                              '__construct'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   11     5        INIT_METHOD_CALL                                         !0, 'getParameters'
          6        DO_FCALL                                      0  $5      
          7        FETCH_DIM_R                                      ~6      $5, 0
          8        ASSIGN                                                   !1, ~6
   12     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, 'isDefaultValueConstant'
         14        DO_FCALL                                      0  $9      
         15        SEND_VAR                                                 $9
         16        INIT_METHOD_CALL                                         !1, 'allowsNull'
         17        DO_FCALL                                      0  $10     
         18        SEND_VAR                                                 $10
         19        INIT_METHOD_CALL                                         !1, 'getDefaultValue'
         20        DO_FCALL                                      0  $11     
         21        SEND_VAR                                                 $11
         22        DO_ICALL                                                 
         23      > 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/jiepI
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

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.18 ms | 1395 KiB | 15 Q