3v4l.org

run code in 300+ PHP versions simultaneously
<?php test(); function test(){ echo 'Test works'; } //output: Test works $closure = function(){ closure_test(); }; $closure(); function closure_test(){ echo 'Closure test works'; } //expected output: Closure test works //actual output: Fatal error: Call to undefined function closure_test()
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C38ZU
function name:  (null)
number of ops:  7
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       'test'
          1        DO_FCALL                                      0          
   11     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FC38ZU%3A11%240'
          3        ASSIGN                                                   !0, ~2
   14     4        INIT_DYNAMIC_CALL                                        !0
          5        DO_FCALL                                      0          
   21     6      > RETURN                                                   1

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

End of function test

Function %00%7Bclosure%7D%2Fin%2FC38ZU%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C38ZU
function name:  {closure}
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL_BY_NAME                                       'closure_test'
          1        DO_FCALL                                      0          
   13     2      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FC38ZU%3A11%240

Function closure_test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C38ZU
function name:  closure_test
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ECHO                                                     'Closure+test+works'
   18     1      > RETURN                                                   null

End of function closure_test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.01 ms | 1394 KiB | 13 Q