3v4l.org

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

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

End of function dosomething

End of class TestSampleClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.45 ms | 1395 KiB | 15 Q