3v4l.org

run code in 500+ PHP versions simultaneously
<?php class x { function __construct($i = 0) { echo __METHOD__.PHP_EOL;} function __invoke() { echo __METHOD__.PHP_EOL;} } $x = new x; $y = new $x()(); // identical to //$y = (new $x(0)) () var_dump($y); // NULL ?>
Output for 8.4.1 - 8.4.3
x::__construct x::__construct x::__invoke NULL
Output for 8.2.0 - 8.2.27, 8.3.0 - 8.3.16
Parse error: syntax error, unexpected token "(" in /in/7G8C7 on line 11
Process exited with code 255.

preferences:
51.89 ms | 683 KiB | 3 Q