3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace { $closure = function () { var_dump(CONSTANT()); }; $closure = $closure->bindTo(null, 'Foo\\Scope'); $closure(); $closure = $closure->bindTo(null, 'Bar\\Scope'); $closure(); } namespace Foo { function CONSTANT() { return __NAMESPACE__; } class Scope {} } namespace Bar { function CONSTANT() { return __NAMESPACE__; } class Scope {} }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NRDpU
function name:  (null)
number of ops:  17
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FNRDpU%3A4%240'
          1        ASSIGN                                                   !0, ~1
    8     2        INIT_METHOD_CALL                                         !0, 'bindTo'
          3        SEND_VAL_EX                                              null
          4        SEND_VAL_EX                                              'Foo%5CScope'
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !0, $3
    9     7        INIT_DYNAMIC_CALL                                        !0
          8        DO_FCALL                                      0          
   10     9        INIT_METHOD_CALL                                         !0, 'bindTo'
         10        SEND_VAL_EX                                              null
         11        SEND_VAL_EX                                              'Bar%5CScope'
         12        DO_FCALL                                      0  $6      
         13        ASSIGN                                                   !0, $6
   11    14        INIT_DYNAMIC_CALL                                        !0
         15        DO_FCALL                                      0          
   29    16      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FNRDpU%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NRDpU
function name:  {closure}
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'constant'
          2        DO_ICALL                                         $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
    6     5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FNRDpU%3A4%240

Function foo%5Cconstant:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NRDpU
function name:  Foo\CONSTANT
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E > > RETURN                                                   'Foo'
   18     1*     > RETURN                                                   null

End of function foo%5Cconstant

Function bar%5Cconstant:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NRDpU
function name:  Bar\CONSTANT
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E > > RETURN                                                   'Bar'
   26     1*     > RETURN                                                   null

End of function bar%5Cconstant

Class Foo\Scope: [no user functions]
Class Bar\Scope: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.28 ms | 1396 KiB | 17 Q