3v4l.org

run code in 300+ PHP versions simultaneously
<?php $d = '<data> <items> <item> <sometag myattribute="foo">first node</sometag> </item> <item> <sometag myattribute="bar">second node</sometag> </item> </items> </data>'; $xmlobj = new SimpleXMLElement($xml); echo $xmlobj->items->item[0]->sometag; $d = '<data> <items> <item> <sometag myattribute="foo">first node</sometag> <sometag myattribute="ad">second node</sometag> </item> <item> <sometag myattribute="bar">second node</sometag> </item> </items> </data>'; $xmlobj = new SimpleXMLElement($xml); echo $xmlobj->items->item[0]->sometag;
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $xml in /in/vAO7F on line 14 Deprecated: SimpleXMLElement::__construct(): Passing null to parameter #1 ($data) of type string is deprecated in /in/vAO7F on line 14 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/vAO7F:14 Stack trace: #0 /in/vAO7F(14): SimpleXMLElement->__construct('') #1 {main} thrown in /in/vAO7F on line 14
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:
65.74 ms | 401 KiB | 8 Q