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); var_dump($obj);exit; foreach ($obj->condition as $event) { echo $event->objectId . '<br/>'; }
Output for 5.1.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
object(SimpleXMLIterator)#1 (2) { ["@attributes"]=> array(1) { ["type"]=> string(2) "or" } ["event"]=> array(5) { [0]=> object(SimpleXMLIterator)#2 (1) { ["@attributes"]=> array(4) { ["objType"]=> string(1) "s" ["objectId"]=> string(3) "144" ["eventType"]=> string(2) "tr" ["event"]=> string(9) "triggered" } } [1]=> object(SimpleXMLIterator)#3 (1) { ["@attributes"]=> array(4) { ["objType"]=> string(1) "s" ["objectId"]=> string(3) "149" ["eventType"]=> string(2) "tr" ["event"]=> string(9) "triggered" } } [2]=> object(SimpleXMLIterator)#4 (1) { ["@attributes"]=> array(4) { ["objType"]=> string(1) "s" ["objectId"]=> string(3) "159" ["eventType"]=> string(2) "tr" ["event"]=> string(9) "triggered" } } [3]=> object(SimpleXMLIterator)#5 (1) { ["@attributes"]=> array(4) { ["objType"]=> string(1) "s" ["objectId"]=> string(3) "160" ["eventType"]=> string(2) "tr" ["event"]=> string(9) "triggered" } } [4]=> object(SimpleXMLIterator)#6 (1) { ["@attributes"]=> array(4) { ["objType"]=> string(1) "s" ["objectId"]=> string(3) "145" ["eventType"]=> string(2) "tr" ["event"]=> string(9) "triggered" } } } }
Output for 5.0.0 - 5.1.1
object(SimpleXMLIterator)#1 (1) { ["event"]=> array(5) { [0]=> object(SimpleXMLIterator)#2 (0) { } [1]=> object(SimpleXMLIterator)#3 (0) { } [2]=> object(SimpleXMLIterator)#4 (0) { } [3]=> object(SimpleXMLIterator)#5 (0) { } [4]=> object(SimpleXMLIterator)#6 (0) { } } }
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: simplexmliterator in /in/Od7bX on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: simplexmliterator in /in/Od7bX on line 11