3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public function bar($param1 = true, $param2) { } } $reflectionMethod = new \ReflectionMethod('Foo', 'bar'); $methodArgs = $reflectionMethod->getParameters(); var_dump($methodArgs[0]->isOptional()); //$reflectionMethod->setAccessible(true); //$reflectionMethod->invoke();
based on 9jtt8
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/r3BfS
function name:  (null)
number of ops:  16
compiled vars:  !0 = $reflectionMethod, !1 = $methodArgs
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  12     1        NEW                                              $3      :-6
         2        SEND_VAL_EX                                              'Foo'
         3        SEND_VAL_EX                                              'bar'
         4        DO_FCALL                                      0          
         5        ASSIGN                                                   !0, $3
  13     6        INIT_METHOD_CALL                                         !0, 'getParameters'
         7        DO_FCALL                                      0  $6      
         8        ASSIGN                                                   !1, $6
  14     9        INIT_FCALL                                               'var_dump'
        10        FETCH_DIM_R                                      $8      !1, 0
        11        INIT_METHOD_CALL                                         $8, 'isOptional'
        12        DO_FCALL                                      0  $9      
        13        SEND_VAR                                                 $9
        14        DO_ICALL                                                 
        15      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/r3BfS
function name:  bar
number of ops:  3
compiled vars:  !0 = $param1, !1 = $param2
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   6     0  E >   RECV_INIT                                        !0      <true>
         1        RECV                                             !1      
   8     2      > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 7.3.0