3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = <<<XML <a> <foo name="one" game="lonely">1</foo> <foo name="two" game"wow">2</foo> </a> XML; $xml = simplexml_load_string($string); foreach($xml->foo->attributes() as $a => $b) { echo $a,'="',$b,"\"\n"; } ?>
based on jU7Ag
Output for 7.2.0
Warning: simplexml_load_string(): Entity: line 3: parser error : Specification mandate value for attribute game in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : attributes construct error in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : Couldn't find end of Start Tag foo line 3 in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : Opening and ending tag mismatch: a line 1 and foo in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 4: parser error : Extra content at the end of the document in /in/4HDnQ on line 9 Warning: simplexml_load_string(): </a> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Notice: Trying to get property 'foo' of non-object in /in/4HDnQ on line 10 Fatal error: Uncaught Error: Call to a member function attributes() on null in /in/4HDnQ:10 Stack trace: #0 {main} thrown in /in/4HDnQ on line 10
Process exited with code 255.
Output for 7.0.0 - 7.1.10
Warning: simplexml_load_string(): Entity: line 3: parser error : Specification mandate value for attribute game in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : attributes construct error in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : Couldn't find end of Start Tag foo line 3 in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : Opening and ending tag mismatch: a line 1 and foo in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 4: parser error : Extra content at the end of the document in /in/4HDnQ on line 9 Warning: simplexml_load_string(): </a> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Notice: Trying to get property of non-object in /in/4HDnQ on line 10 Fatal error: Uncaught Error: Call to a member function attributes() on null in /in/4HDnQ:10 Stack trace: #0 {main} thrown in /in/4HDnQ on line 10
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Warning: simplexml_load_string(): Entity: line 3: parser error : Specification mandate value for attribute game in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : attributes construct error in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : Couldn't find end of Start Tag foo line 3 in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : Opening and ending tag mismatch: a line 1 and foo in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 4: parser error : Extra content at the end of the document in /in/4HDnQ on line 9 Warning: simplexml_load_string(): </a> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Notice: Trying to get property of non-object in /in/4HDnQ on line 10 Fatal error: Call to a member function attributes() on null in /in/4HDnQ on line 10
Process exited with code 255.
Output for 5.3.19 - 5.5.35
Warning: simplexml_load_string(): Entity: line 3: parser error : Specification mandate value for attribute game in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : attributes construct error in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : Couldn't find end of Start Tag foo line 3 in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 3: parser error : Opening and ending tag mismatch: a line 1 and foo in /in/4HDnQ on line 9 Warning: simplexml_load_string(): <foo name="two" game"wow">2</foo> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Warning: simplexml_load_string(): Entity: line 4: parser error : Extra content at the end of the document in /in/4HDnQ on line 9 Warning: simplexml_load_string(): </a> in /in/4HDnQ on line 9 Warning: simplexml_load_string(): ^ in /in/4HDnQ on line 9 Notice: Trying to get property of non-object in /in/4HDnQ on line 10 Fatal error: Call to a member function attributes() on a non-object in /in/4HDnQ on line 10
Process exited with code 255.