3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $a; public function __construct(int $a) { $this->a = $a; } public function __invoke(int $a) : Bar { return new Bar($a); } } class Bar { private $a; public function __construct(int $a) { $this->a = $a; } } $foo = new Foo(1); $bar = new $foo(2); $bar2 = new ($foo(2)); var_dump($foo); var_dump($bar); var_dump($bar2);
Output for git.master_jit, git.master, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Bar::__construct(), 0 passed in /in/Wh8nD on line 35 and exactly 1 expected in /in/Wh8nD:25 Stack trace: #0 /in/Wh8nD(35): Bar->__construct() #1 {main} thrown in /in/Wh8nD on line 25
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
40.21 ms | 401 KiB | 8 Q