3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = new SimpleXMLElement('<vehicle id="8" identyfikator="23"> <name>MAREK</name> <recorder ppp="fdfd">8</recorder> <production-date>0</production-date> <registration-number>SI40996</registration-number> <fuel> <type> </type> <nominal>0</nominal> <drive>0</drive> <work>0</work> <stay>0</stay> </fuel> <attr> <at nam="EMAIL" typ="5">w@wp.pl</at> <at nam="PHONE" typ="4">12345</at> </attr> </vehicle>'); echo '<pre>'; var_dump($xml); var_dump($xml->recorder); var_dump($xml->attr); var_dump($xml->attr->at);
based on KPIlO
Output for 5.5.27 - 5.5.35, 5.6.11 - 7.2.0
<pre>object(SimpleXMLElement)#1 (7) { ["@attributes"]=> array(2) { ["id"]=> string(1) "8" ["identyfikator"]=> string(2) "23" } ["name"]=> string(5) "MAREK" ["recorder"]=> string(1) "8" ["production-date"]=> string(1) "0" ["registration-number"]=> string(7) "SI40996" ["fuel"]=> object(SimpleXMLElement)#2 (5) { ["type"]=> object(SimpleXMLElement)#4 (1) { [0]=> string(7) " " } ["nominal"]=> string(1) "0" ["drive"]=> string(1) "0" ["work"]=> string(1) "0" ["stay"]=> string(1) "0" } ["attr"]=> object(SimpleXMLElement)#3 (1) { ["at"]=> array(2) { [0]=> string(7) "w@wp.pl" [1]=> string(5) "12345" } } } object(SimpleXMLElement)#3 (2) { ["@attributes"]=> array(1) { ["ppp"]=> string(4) "fdfd" } [0]=> string(1) "8" } object(SimpleXMLElement)#3 (1) { ["at"]=> array(2) { [0]=> string(7) "w@wp.pl" [1]=> string(5) "12345" } } object(SimpleXMLElement)#4 (3) { ["@attributes"]=> array(2) { ["nam"]=> string(5) "EMAIL" ["typ"]=> string(1) "5" } [0]=> string(7) "w@wp.pl" [1]=> string(5) "12345" }
Output for 5.4.9 - 5.5.26, 5.6.8 - 5.6.10
<pre>object(SimpleXMLElement)#1 (7) { ["@attributes"]=> array(2) { ["id"]=> string(1) "8" ["identyfikator"]=> string(2) "23" } ["name"]=> string(5) "MAREK" ["recorder"]=> string(1) "8" ["production-date"]=> string(1) "0" ["registration-number"]=> string(7) "SI40996" ["fuel"]=> object(SimpleXMLElement)#2 (5) { ["type"]=> object(SimpleXMLElement)#4 (0) { } ["nominal"]=> string(1) "0" ["drive"]=> string(1) "0" ["work"]=> string(1) "0" ["stay"]=> string(1) "0" } ["attr"]=> object(SimpleXMLElement)#3 (1) { ["at"]=> array(2) { [0]=> string(7) "w@wp.pl" [1]=> string(5) "12345" } } } object(SimpleXMLElement)#3 (2) { ["@attributes"]=> array(1) { ["ppp"]=> string(4) "fdfd" } [0]=> string(1) "8" } object(SimpleXMLElement)#3 (1) { ["at"]=> array(2) { [0]=> string(7) "w@wp.pl" [1]=> string(5) "12345" } } object(SimpleXMLElement)#4 (3) { ["@attributes"]=> array(2) { ["nam"]=> string(5) "EMAIL" ["typ"]=> string(1) "5" } [0]=> string(7) "w@wp.pl" [1]=> string(5) "12345" }
Output for 5.3.19 - 5.3.29
<pre>object(SimpleXMLElement)#1 (7) { ["@attributes"]=> array(2) { ["id"]=> string(1) "8" ["identyfikator"]=> string(2) "23" } ["name"]=> string(5) "MAREK" ["recorder"]=> string(1) "8" ["production-date"]=> string(1) "0" ["registration-number"]=> string(7) "SI40996" ["fuel"]=> object(SimpleXMLElement)#2 (5) { ["type"]=> object(SimpleXMLElement)#4 (1) { [0]=> string(7) " " } ["nominal"]=> string(1) "0" ["drive"]=> string(1) "0" ["work"]=> string(1) "0" ["stay"]=> string(1) "0" } ["attr"]=> object(SimpleXMLElement)#3 (1) { ["at"]=> array(2) { [0]=> string(7) "w@wp.pl" [1]=> string(5) "12345" } } } object(SimpleXMLElement)#3 (2) { ["@attributes"]=> array(1) { ["ppp"]=> string(4) "fdfd" } [0]=> string(1) "8" } object(SimpleXMLElement)#3 (1) { ["at"]=> array(2) { [0]=> string(7) "w@wp.pl" [1]=> string(5) "12345" } } object(SimpleXMLElement)#4 (2) { ["@attributes"]=> array(2) { ["nam"]=> string(5) "EMAIL" ["typ"]=> string(1) "5" } [0]=> string(7) "w@wp.pl" }