3v4l.org

run code in 300+ PHP versions simultaneously
<?php function main() { $xml = '<foo><bar /></foo>'; $dom1 = new DOMDocument(); $dom1->loadXML($xml); $dom2 = clone $dom1; var_dump($dom1->firstChild->nodeName); var_dump($dom2->firstChild->nodeName); $child1 = $dom1->firstChild; $child2 = clone $child1; $child1->foo = 12; $child2->foo = 88; return array($dom1, $dom2, $child1, $child2); } list($x, $y, $c, $d) = main(); var_dump($x->firstChild->foo); var_dump($y->firstChild->foo);
Output for git.master, git.master_jit, rfc.property-hooks
string(3) "foo" string(3) "foo" Deprecated: Creation of dynamic property DOMElement::$foo is deprecated in /in/TM9fV on line 15 Deprecated: Creation of dynamic property DOMElement::$foo is deprecated in /in/TM9fV on line 16 int(12) Warning: Undefined property: DOMElement::$foo in /in/TM9fV on line 24 NULL

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:
64.26 ms | 402 KiB | 8 Q