3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('CL', function () { echo "hello\n"; }); class Foo { public const \Closure CL = CL; } (Foo::CL)();
Output for 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
hello
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29
Parse error: syntax error, unexpected fully qualified name "\Closure" in /in/F2VKn on line 7
Process exited with code 255.

preferences:
65.56 ms | 407 KiB | 5 Q