3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyNode { public $name; public $children = array(); public $parent; public function __construct(string $name, $parent) { echo "in constructor\n"; $this->name = $name; echo "name: " . $this->name . ".\n"; $this->parent = $parent; echo "parent: " . $this->parent . ".\n"; } } $RootNode = new MyNode("Root", null); echo "done root x\n"; $ChildNode = new MyNode("Child1", $RootNode); echo "done child\n";
Output for git.master, git.master_jit, rfc.property-hooks
in constructor name: Root. parent: . done root x in constructor name: Child1. Fatal error: Uncaught Error: Object of class MyNode could not be converted to string in /in/T7Os5:12 Stack trace: #0 /in/T7Os5(18): MyNode->__construct('Child1', Object(MyNode)) #1 {main} thrown in /in/T7Os5 on line 12
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:
81.81 ms | 406 KiB | 5 Q