3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A{ function B($x , $y=null , $z=null) { } } $m = new ReflectionMethod('a','b'); $p = $m->getParameters(); var_dump($p[0]->isOptionnal() ? $p->getDefaultValue(): 'no');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tuKHc
function name:  (null)
number of ops:  21
compiled vars:  !0 = $m, !1 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $2      'ReflectionMethod'
          1        SEND_VAL_EX                                              'a'
          2        SEND_VAL_EX                                              'b'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   11     5        INIT_METHOD_CALL                                         !0, 'getParameters'
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !1, $5
   12     8        INIT_FCALL                                               'var_dump'
          9        FETCH_DIM_R                                      ~7      !1, 0
         10        INIT_METHOD_CALL                                         ~7, 'isOptionnal'
         11        DO_FCALL                                      0  $8      
         12      > JMPZ                                                     $8, ->17
         13    >   INIT_METHOD_CALL                                         !1, 'getDefaultValue'
         14        DO_FCALL                                      0  $9      
         15        QM_ASSIGN                                        ~10     $9
         16      > JMP                                                      ->18
         17    >   QM_ASSIGN                                        ~10     'no'
         18    >   SEND_VAL                                                 ~10
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

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

End of function b

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.94 ms | 1396 KiB | 15 Q