3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function __construct( private Closure $callback ) {} public function show(): void { call_user_func($this->callback); } } new A(function() { echo 'Hello world'; })->show();
Output for 8.4.1 - 8.4.3
Hello world
Output for 8.2.0 - 8.2.27, 8.3.0 - 8.3.16
Parse error: syntax error, unexpected token "->" in /in/HT8QR on line 15
Process exited with code 255.

preferences:
147.62 ms | 954 KiB | 7 Q