3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestSampleClass { public function doSomething($one = null, $two, $three = array()) { return null; } } $tests = array('one', 'two', 'three' ); 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/HVX5R
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>
   16     1      > FE_RESET_R                                       $4      !0, ->14
          2    > > FE_FETCH_R                                               $4, !1, ->14
   18     3    >   NEW                                              $5      'ReflectionParameter'
          4        SEND_VAL_EX                                              <array>
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $5
   20     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !2, 'isOptional'
         10        DO_FCALL                                      0  $8      
         11        SEND_VAR                                                 $8
         12        DO_ICALL                                                 
   16    13      > JMP                                                      ->2
         14    >   FE_FREE                                                  $4
   21    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/HVX5R
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      <array>
    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:
166.44 ms | 1395 KiB | 15 Q