3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Main { public function run() { echo "Deep item"; } } class Maker { public function getText() { return function () { return new Main(); }; } } class Tester { private $param; public function __constructor($param) { $this->param = $param; } public function go() { $this->param->run(); } } echo "\n instantiate Maker:\n"; $maker = new Maker(); echo "\n instantiate Tester:\n"; $tester = new Tester($maker->getText()); echo "\n Run Tester:\n"; $tester->go();
Output for git.master, git.master_jit, rfc.property-hooks
instantiate Maker: instantiate Tester: Run Tester: Fatal error: Uncaught Error: Call to a member function run() on null in /in/HHIrV:30 Stack trace: #0 /in/HHIrV(39): Tester->go() #1 {main} thrown in /in/HHIrV on line 30
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:
51.12 ms | 401 KiB | 8 Q