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->__invoke(2); var_dump($foo); var_dump($bar); var_dump($bar2);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined property: Foo::$__invoke in /in/eWARQ on line 35 Fatal error: Uncaught Error: Class name must be a valid object or a string in /in/eWARQ:35 Stack trace: #0 {main} thrown in /in/eWARQ on line 35
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:
53.95 ms | 401 KiB | 8 Q