3v4l.org

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

Function func:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a60Wl
function name:  FUNC
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   ''
    6     1*     > RETURN                                                   null

End of function func

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

End of function %00%7Bclosure%7D%2Fin%2Fa60Wl%3A7%240

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

End of function foo%5Cfunc

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

End of function bar%5Cfunc

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.33 ms | 1403 KiB | 16 Q