3v4l.org

run code in 300+ PHP versions simultaneously
<?php class testclass{ public $xmlRequestDom = NULL; function __construct($xmlrequest) { if (gettype($xmlrequest)=='object') { $this->xmlRequestDom = $xmlrequest; } else { $this->xmlRequestDom = new DomDocument(); $this->xmlRequestDom->loadXML($xmlrequest); } $this->setParamsFromXMLRequest(); } function setParamsFromXMLRequest() { $children = $this->xmlRequestDom->documentElement->childNodes; foreach($children as $child) { if($child->nodeType != XML_ELEMENT_NODE) continue; echo $child->nodeName."\n"; } } } $newxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <c:tellervo xmlns:c=\"http://www.tellervo.org/schema/1.0\" xmlns:gml=\"http://www.opengis.net/gml\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:tridas=\"http://www.tridas.org/1.2.2\"> <c:request type=\"create\"> <tridas:object> <tridas:title>ppp</tridas:title> <tridas:type normalStd=\"Tellervo\" normalId=\"1\" normal=\"Site\" /> <tridas:genericField name=\"tellervo.objectLabCode\">ppp</tridas:genericField> </tridas:object>"; $myParamObj = new testclass($newxml);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: DOMDocument::loadXML(): Premature end of data in tag request line 3 in Entity, line: 8 in /in/IMWHf on line 15 Warning: DOMDocument::loadXML(): Premature end of data in tag tellervo line 2 in Entity, line: 8 in /in/IMWHf on line 15 Warning: Attempt to read property "childNodes" on null in /in/IMWHf on line 25 Warning: foreach() argument must be of type array|object, null given in /in/IMWHf on line 27

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