3v4l.org

run code in 500+ PHP versions simultaneously
<?php namespace Foo\Bar\Baz; $closureBeforeDefined = function () { return A_RELATIVE_CONSTANT; }; define('A_RELATIVE_CONSTANT', 'IN GLOBAL NAMESPACE'); var_dump($closureBeforeDefined()); define('Foo\\Bar\\Baz\\A_RELATIVE_CONSTANT', 'IN RELATIVE NAMESPACE'); $closureAfterDefined = function () { return A_RELATIVE_CONSTANT; }; var_dump($closureBeforeDefined()); var_dump($closureAfterDefined());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6loRa
function name:  (null)
number of ops:  28
compiled vars:  !0 = $closureBeforeDefined, !1 = $closureAfterDefined
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                              ~2      [0]
          1        ASSIGN                                                       !0, ~2
    9     2        INIT_NS_FCALL_BY_NAME                                        'Foo%5CBar%5CBaz%5Cdefine'
          3        SEND_VAL_EX                                                  'A_RELATIVE_CONSTANT'
          4        SEND_VAL_EX                                                  'IN+GLOBAL+NAMESPACE'
          5        DO_FCALL                                          0          
   11     6        INIT_NS_FCALL_BY_NAME                                        'Foo%5CBar%5CBaz%5Cvar_dump'
          7        INIT_DYNAMIC_CALL                                            !0
          8        DO_FCALL                                          0  $5      
          9        SEND_VAR_NO_REF_EX                                           $5
         10        DO_FCALL                                          0          
   13    11        INIT_NS_FCALL_BY_NAME                                        'Foo%5CBar%5CBaz%5Cdefine'
         12        SEND_VAL_EX                                                  'Foo%5CBar%5CBaz%5CA_RELATIVE_CONSTANT'
         13        SEND_VAL_EX                                                  'IN+RELATIVE+NAMESPACE'
         14        DO_FCALL                                          0          
   15    15        DECLARE_LAMBDA_FUNCTION                              ~8      [1]
         16        ASSIGN                                                       !1, ~8
   19    17        INIT_NS_FCALL_BY_NAME                                        'Foo%5CBar%5CBaz%5Cvar_dump'
         18        INIT_DYNAMIC_CALL                                            !0
         19        DO_FCALL                                          0  $10     
         20        SEND_VAR_NO_REF_EX                                           $10
         21        DO_FCALL                                          0          
   20    22        INIT_NS_FCALL_BY_NAME                                        'Foo%5CBar%5CBaz%5Cvar_dump'
         23        INIT_DYNAMIC_CALL                                            !1
         24        DO_FCALL                                          0  $12     
         25        SEND_VAR_NO_REF_EX                                           $12
         26        DO_FCALL                                          0          
         27      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6loRa
function name:  {closure:/in/6loRa:5}
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   FETCH_CONSTANT                                       ~0      'Foo%5CBar%5CBaz%5CA_RELATIVE_CONSTANT'
          1      > RETURN                                                       ~0
    7     2*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6loRa
function name:  {closure:/in/6loRa:15}
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   FETCH_CONSTANT                                       ~0      'Foo%5CBar%5CBaz%5CA_RELATIVE_CONSTANT'
          1      > RETURN                                                       ~0
   17     2*     > RETURN                                                       null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
153.56 ms | 3347 KiB | 15 Q