3v4l.org

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

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3pHfU
function name:  foo
number of ops:  3
compiled vars:  !0 = $bar, !1 = $baz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV_INIT                                        !0      'something'
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.7 ms | 1387 KiB | 15 Q