3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 5.0.0 - 5.6.28, 7.0.0 - 7.1.0
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 Notice: Trying to get property of non-object in /in/IMWHf on line 25 Warning: Invalid argument supplied for foreach() in /in/IMWHf on line 27
Output for hhvm-3.12.0
Warning: Premature end of data in tag request line 3 in Entity, line: 8 Warning: Premature end of data in tag tellervo line 2 in Entity, line: 8 Notice: Cannot access property on non-object in /in/IMWHf on line 25 Warning: Invalid argument supplied for foreach() in /in/IMWHf on line 32
Output for hhvm-3.10.0
Warning: Premature end of data in tag request line 3 in Entity, line: 8 Warning: Premature end of data in tag tellervo line 2 in Entity, line: 8 Notice: Cannot access property on non-object in /in/IMWHf on line 29 Warning: Invalid argument supplied for foreach() in /in/IMWHf on line 44
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/IMWHf on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/IMWHf on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/IMWHf on line 4
Process exited with code 255.