3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = '<?xml version="1.0" encoding="UTF-8"?> <condition type="or"> <event objType="s" objectId="144" eventType="tr" event="triggered"/> <event objType="s" objectId="149" eventType="tr" event="triggered"/> <event objType="s" objectId="159" eventType="tr" event="triggered"/> <event objType="s" objectId="160" eventType="tr" event="triggered"/> <event objType="s" objectId="145" eventType="tr" event="triggered"/> </condition>'; $obj = new SimpleXMLIterator($xml); foreach ($obj->event as $event) { var_dump($event->attributes()['objectId']); //echo $event->{'@attributes'}['objectId'] . '<br/>'; }
Output for 5.4.0 - 7.1.0
object(SimpleXMLIterator)#7 (1) { [0]=> string(3) "144" } object(SimpleXMLIterator)#6 (1) { [0]=> string(3) "149" } object(SimpleXMLIterator)#5 (1) { [0]=> string(3) "159" } object(SimpleXMLIterator)#4 (1) { [0]=> string(3) "160" } object(SimpleXMLIterator)#7 (1) { [0]=> string(3) "145" }
Output for 5.2.3 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/dWYFo on line 14
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.2
<br /> <b>Parse error</b>: syntax error, unexpected '[' in <b>/in/dWYFo</b> on line <b>14</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
<br /> <b>Parse error</b>: parse error, unexpected '[' in <b>/in/dWYFo</b> on line <b>14</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error in <b>/in/dWYFo</b> on line <b>14</b><br />
Process exited with code 255.