3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute] readonly class Foo { public function __construct(public Closure $callable) {} } // Allowed #[Foo(static function () {})] class Example {} // Not allowed #[Foo(static fn () => null)] class Example2 {}
Output for 8.5.2
Fatal error: Constant expression contains invalid operations in /in/O0dN8 on line 17 Stack trace: #0 {main}
Process exited with code 255.

preferences:
172.66 ms | 1010 KiB | 7 Q