3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo\Bar\Baz { $closureBeforeDefined = function () { return relativeFunction(); }; } namespace { function relativeFunction() { return 'IN GLOBAL NAMESPACE'; } } namespace Foo\Bar\Baz { var_dump($closureBeforeDefined()); function relativeFunction() { return 'IN RELATIVE NAMESPACE'; } $closureAfterDefined = function () { return relativeFunction(); }; var_dump($closureBeforeDefined()); var_dump($closureAfterDefined()); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b5m32
function name:  (null)
number of ops:  20
compiled vars:  !0 = $closureBeforeDefined, !1 = $closureAfterDefined
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00foo%5Cbar%5Cbaz%5C%7Bclosure%7D%2Fin%2Fb5m32%3A5%240'
          1        ASSIGN                                                   !0, ~2
   18     2        INIT_NS_FCALL_BY_NAME                                    'Foo%5CBar%5CBaz%5Cvar_dump'
          3        INIT_DYNAMIC_CALL                                        !0
          4        DO_FCALL                                      0  $4      
          5        SEND_VAR_NO_REF_EX                                       $4
          6        DO_FCALL                                      0          
   24     7        DECLARE_LAMBDA_FUNCTION                                  '%00foo%5Cbar%5Cbaz%5C%7Bclosure%7D%2Fin%2Fb5m32%3A24%241'
          8        ASSIGN                                                   !1, ~6
   28     9        INIT_NS_FCALL_BY_NAME                                    'Foo%5CBar%5CBaz%5Cvar_dump'
         10        INIT_DYNAMIC_CALL                                        !0
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR_NO_REF_EX                                       $8
         13        DO_FCALL                                      0          
   29    14        INIT_NS_FCALL_BY_NAME                                    'Foo%5CBar%5CBaz%5Cvar_dump'
         15        INIT_DYNAMIC_CALL                                        !1
         16        DO_FCALL                                      0  $10     
         17        SEND_VAR_NO_REF_EX                                       $10
         18        DO_FCALL                                      0          
   30    19      > RETURN                                                   1

Function %00foo%5Cbar%5Cbaz%5C%7Bclosure%7D%2Fin%2Fb5m32%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b5m32
function name:  Foo\Bar\Baz\{closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_NS_FCALL_BY_NAME                                    'Foo%5CBar%5CBaz%5CrelativeFunction'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
    7     3*     > RETURN                                                   null

End of function %00foo%5Cbar%5Cbaz%5C%7Bclosure%7D%2Fin%2Fb5m32%3A5%240

Function relativefunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b5m32
function name:  relativeFunction
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > RETURN                                                   'IN+GLOBAL+NAMESPACE'
   13     1*     > RETURN                                                   null

End of function relativefunction

Function foo%5Cbar%5Cbaz%5Crelativefunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b5m32
function name:  Foo\Bar\Baz\relativeFunction
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E > > RETURN                                                   'IN+RELATIVE+NAMESPACE'
   22     1*     > RETURN                                                   null

End of function foo%5Cbar%5Cbaz%5Crelativefunction

Function %00foo%5Cbar%5Cbaz%5C%7Bclosure%7D%2Fin%2Fb5m32%3A24%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b5m32
function name:  Foo\Bar\Baz\{closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_NS_FCALL_BY_NAME                                    'Foo%5CBar%5CBaz%5CrelativeFunction'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   26     3*     > RETURN                                                   null

End of function %00foo%5Cbar%5Cbaz%5C%7Bclosure%7D%2Fin%2Fb5m32%3A24%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.4 ms | 1403 KiB | 17 Q