3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dom=simplexml_load_string("<test></test>"); $dom->addChild(">.<","1,2,3"); $xml=$dom->asXML(); echo $xml; /* echos: <?xml version="1.0"?> <test><3D>1,2,3</3D></test> */ $dom=simplexml_load_string($xml); /* generates a whole lots of warnings, and refuses to create an object. */
Output for 5.1.3 - 5.6.28, 7.0.0 - 7.1.0
<?xml version="1.0"?> <test><>.<>1,2,3</>.<></test> Warning: simplexml_load_string(): Entity: line 2: parser error : StartTag: invalid element name in /in/6KQ78 on line 12 Warning: simplexml_load_string(): <test><>.<>1,2,3</>.<></test> in /in/6KQ78 on line 12 Warning: simplexml_load_string(): ^ in /in/6KQ78 on line 12 Warning: simplexml_load_string(): Entity: line 2: parser error : StartTag: invalid element name in /in/6KQ78 on line 12 Warning: simplexml_load_string(): <test><>.<>1,2,3</>.<></test> in /in/6KQ78 on line 12 Warning: simplexml_load_string(): ^ in /in/6KQ78 on line 12 Warning: simplexml_load_string(): Entity: line 2: parser error : Opening and ending tag mismatch: test line 2 and unparseable in /in/6KQ78 on line 12 Warning: simplexml_load_string(): <test><>.<>1,2,3</>.<></test> in /in/6KQ78 on line 12 Warning: simplexml_load_string(): ^ in /in/6KQ78 on line 12 Warning: simplexml_load_string(): Entity: line 2: parser error : Extra content at the end of the document in /in/6KQ78 on line 12 Warning: simplexml_load_string(): <test><>.<>1,2,3</>.<></test> in /in/6KQ78 on line 12 Warning: simplexml_load_string(): ^ in /in/6KQ78 on line 12
Output for hhvm-3.10.0 - 3.12.0
<?xml version="1.0"?> <test><>.<>1,2,3</>.<></test> Entity: line 2: parser error : StartTag: invalid element name <test><>.<>1,2,3</>.<></test> ^ Entity: line 2: parser error : StartTag: invalid element name <test><>.<>1,2,3</>.<></test> ^ Entity: line 2: parser error : Opening and ending tag mismatch: test line 2 and unparseable <test><>.<>1,2,3</>.<></test> ^ Entity: line 2: parser error : Extra content at the end of the document <test><>.<>1,2,3</>.<></test> ^
Output for 5.0.0 - 5.1.2
Fatal error: Call to undefined method SimpleXMLElement::addChild() in /in/6KQ78 on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_string() in /in/6KQ78 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_string() in /in/6KQ78 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_string() in /in/6KQ78 on line 3