3v4l.org

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

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

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.56 ms | 1396 KiB | 15 Q