3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bar() {} class C { static function foo($x = null) {} } $reflMethod = new ReflectionMethod('C', 'foo'); $params = $reflMethod->getParameters(); $param = $params[0]; $param->isOptional(); $reflFunction = new ReflectionFunction('bar'); $params = $reflFunction->getParameters(); $param = $params[0]; $param->isOptional();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q9heA
function name:  (null)
number of ops:  24
compiled vars:  !0 = $reflMethod, !1 = $params, !2 = $param, !3 = $reflFunction
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $4      'ReflectionMethod'
          1        SEND_VAL_EX                                              'C'
          2        SEND_VAL_EX                                              'foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $4
   10     5        INIT_METHOD_CALL                                         !0, 'getParameters'
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !1, $7
   11     8        FETCH_DIM_R                                      ~9      !1, 0
          9        ASSIGN                                                   !2, ~9
   12    10        INIT_METHOD_CALL                                         !2, 'isOptional'
         11        DO_FCALL                                      0          
   14    12        NEW                                              $12     'ReflectionFunction'
         13        SEND_VAL_EX                                              'bar'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !3, $12
   15    16        INIT_METHOD_CALL                                         !3, 'getParameters'
         17        DO_FCALL                                      0  $15     
         18        ASSIGN                                                   !1, $15
   16    19        FETCH_DIM_R                                      ~17     !1, 0
         20        ASSIGN                                                   !2, ~17
   17    21        INIT_METHOD_CALL                                         !2, 'isOptional'
         22        DO_FCALL                                      0          
         23      > RETURN                                                   1

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q9heA
function name:  bar
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > RETURN                                                   null

End of function bar

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

End of function foo

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.96 ms | 1399 KiB | 13 Q