3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Bar { const BAR_E_ERROR = 42; function foo($value = E_ERROR) {} function bar($value = \E_ERROR) {} function baz($value = BAR_E_ERROR) {} } namespace { function foo($value = E_ERROR) {} $list = array('foo', 'Bar\foo', 'Bar\bar', 'Bar\baz'); foreach ($list as $functionName) { $ref = (new ReflectionParameter($functionName, 'value')); var_dump($functionName, $ref->getDefaultValueConstantName(), $ref->getDefaulValue()); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/9EqVs
function name:  (null)
number of ops:  21
compiled vars:  !0 = $list, !1 = $functionName, !2 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CONST                                            'Bar%5CBAR_E_ERROR', 42
   14     1        ASSIGN                                                   !0, <array>
   15     2      > FE_RESET_R                                       $4      !0, ->19
          3    > > FE_FETCH_R                                               $4, !1, ->19
   16     4    >   NEW                                              $5      'ReflectionParameter'
          5        SEND_VAR_EX                                              !1
          6        SEND_VAL_EX                                              'value'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $5
   17     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        INIT_METHOD_CALL                                         !2, 'getDefaultValueConstantName'
         12        DO_FCALL                                      0  $8      
         13        SEND_VAR                                                 $8
         14        INIT_METHOD_CALL                                         !2, 'getDefaulValue'
         15        DO_FCALL                                      0  $9      
         16        SEND_VAR                                                 $9
         17        DO_ICALL                                                 
   15    18      > JMP                                                      ->3
         19    >   FE_FREE                                                  $4
   19    20      > RETURN                                                   1

Function bar%5Cfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9EqVs
function name:  Bar\foo
number of ops:  2
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV_INIT                                        !0      <const ast>
          1      > RETURN                                                   null

End of function bar%5Cfoo

Function bar%5Cbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9EqVs
function name:  Bar\bar
number of ops:  2
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      <const ast>
          1      > RETURN                                                   null

End of function bar%5Cbar

Function bar%5Cbaz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9EqVs
function name:  Bar\baz
number of ops:  2
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV_INIT                                        !0      <const ast>
          1      > RETURN                                                   null

End of function bar%5Cbaz

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9EqVs
function name:  foo
number of ops:  2
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV_INIT                                        !0      <const ast>
          1      > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.76 ms | 1400 KiB | 15 Q