3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestSampleClass { public function doSomething($one = null, $two, $three = null) { return null; } } $tests = array( array('one', null), array('two', null), array('three', null) ); foreach($tests as $test) { $param = new ReflectionParameter(array('TestSampleClass', 'doSomething'), $test[0]); var_dump($param->isDefaultValueAvailable()); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 16
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/WbSMq
function name:  (null)
number of ops:  18
compiled vars:  !0 = $tests, !1 = $test, !2 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   17     1      > FE_RESET_R                                       $4      !0, ->16
          2    > > FE_FETCH_R                                               $4, !1, ->16
   19     3    >   NEW                                              $5      'ReflectionParameter'
          4        SEND_VAL_EX                                              <array>
          5        CHECK_FUNC_ARG                                           
          6        FETCH_DIM_FUNC_ARG                               $6      !1, 0
          7        SEND_FUNC_ARG                                            $6
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $5
   21    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !2, 'isDefaultValueAvailable'
         12        DO_FCALL                                      0  $9      
         13        SEND_VAR                                                 $9
         14        DO_ICALL                                                 
   17    15      > JMP                                                      ->2
         16    >   FE_FREE                                                  $4
   22    17      > RETURN                                                   1

Class TestSampleClass:
Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WbSMq
function name:  doSomething
number of ops:  5
compiled vars:  !0 = $one, !1 = $two, !2 = $three
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      null
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      null
    7     3      > RETURN                                                   null
    8     4*     > RETURN                                                   null

End of function dosomething

End of class TestSampleClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.82 ms | 1396 KiB | 15 Q