3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = <<<T <data> <Report ID="1"> <Date>Review</Date> <vt:lpstr>2</vt:lpstr> </Report> </data> T; $xmlDoc = new DOMDocument(); $xmlDoc->loadXML( $xml ); $searchNode = $xmlDoc->getElementsByTagName( "Report" ); foreach( $searchNode as $searchNode ) { $valueID = $searchNode->getAttribute('ID'); $xmlDate = $searchNode->getElementsByTagName("Date"); $valueDate = $xmlDate->item(0)->nodeValue; $xmlvtlpstr = $searchNode->getElementsByTagName( "vt:lpstr"); $newelement = $xmlvtlpstr->createTextNode('xmlvtlpstr'); $searchNode->replaceChild($xmlvtlpstr, $newelement); $valuevtlpstr = $xmlvtlpstr->item(0)->nodeValue; echo "$valueID - $valueDate - $valuevtlpstr\n"; }
Output for 7.0.0 - 7.3.0beta1
Warning: DOMDocument::loadXML(): Namespace prefix vt on lpstr is not defined in Entity, line: 4 in /in/r339d on line 11 Fatal error: Uncaught Error: Call to undefined method DOMNodeList::createTextNode() in /in/r339d:23 Stack trace: #0 {main} thrown in /in/r339d on line 23
Process exited with code 255.
Output for hhvm-3.22.0
Warning: Namespace prefix vt on lpstr is not defined in Entity, line: 4 in /in/r339d on line -1 Fatal error: Uncaught Error: Call to undefined method DOMNodeList::createTextNode() in /in/r339d:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.21.3
Warning: Namespace prefix vt on lpstr is not defined in Entity, line: 4 in /in/r339d on line 11 Fatal error: Uncaught Error: Call to undefined method DOMNodeList::createTextNode() in /in/r339d:23 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.18.5
Warning: Namespace prefix vt on lpstr is not defined in Entity, line: 4 Fatal error: Uncaught Error: Call to undefined method DOMNodeList::createTextNode() in /in/r339d:23 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Warning: DOMDocument::loadXML(): Namespace prefix vt on lpstr is not defined in Entity, line: 4 in /in/r339d on line 11 Fatal error: Call to undefined method DOMNodeList::createTextNode() in /in/r339d on line 23
Process exited with code 255.