3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = <<<EOD <?xml version="1.0" encoding="UTF-8"?> <gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref"> <gesmes:subject>Reference rates</gesmes:subject> <gesmes:Sender> <gesmes:name>Eesti Pank</gesmes:name> </gesmes:Sender> <Cube> <Cube time="2014-03-04"> <Cube currency="AUD" rate="1.5392" /> <Cube currency="BGN" rate="1.9558" /> <Cube currency="BRL" rate="3.2100" /> <Cube currency="CAD" rate="1.5244" /> <Cube currency="CHF" rate="1.2172" /> <Cube currency="CNY" rate="8.4564" /> <Cube currency="CZK" rate="27.3690" /> <Cube currency="DKK" rate="7.4627" /> <Cube currency="GBP" rate="0.8246" /> <Cube currency="HKD" rate="10.6847" /> <Cube currency="HRK" rate="7.6525" /> <Cube currency="HUF" rate="311.1500" /> <Cube currency="IDR" rate="15957.1100" /> <Cube currency="ILS" rate="4.8055" /> <Cube currency="INR" rate="85.1757" /> <Cube currency="JPY" rate="140.2000" /> <Cube currency="KRW" rate="1474.4700" /> <Cube currency="LTL" rate="3.4528" /> <Cube currency="MXN" rate="18.2977" /> <Cube currency="MYR" rate="4.5049" /> <Cube currency="NOK" rate="8.2485" /> <Cube currency="NZD" rate="1.6411" /> <Cube currency="PHP" rate="61.6390" /> <Cube currency="PLN" rate="4.1865" /> <Cube currency="RON" rate="4.5183" /> <Cube currency="RUB" rate="49.7510" /> <Cube currency="SEK" rate="8.8603" /> <Cube currency="SGD" rate="1.7469" /> <Cube currency="THB" rate="44.6290" /> <Cube currency="TRY" rate="3.0520" /> <Cube currency="USD" rate="1.3768" /> <Cube currency="ZAR" rate="14.9180" /> </Cube> </Cube> </gesmes:Envelope> EOD; $sxe = new SimpleXMLElement($xml); $sxe->registerXPathNamespace('g', 'http://www.gesmes.org/xml/2002-08-01'); $sxe->registerXPathNamespace('pank', 'http://www.ecb.int/vocabulary/2002-08-01/eurofxref'); $result = $sxe->xpath('//pank:Cube'); var_dump( $result );

Abusive script

This script was stopped while abusing our resources

Output for 5.3.0 - 7.0.5
array(34) { [0]=> object(SimpleXMLElement)#2 (1) { ["Cube"]=> object(SimpleXMLElement)#36 (2) { ["@attributes"]=> array(1) { ["time"]=> string(10) "2014-03-04" } ["Cube"]=> array(32) { [0]=> object(SimpleXMLElement)#37 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "AUD" ["rate"]=> string(6) "1.5392" } } [1]=> object(SimpleXMLElement)#38 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "BGN" ["rate"]=> string(6) "1.9558" } } [2]=> object(SimpleXMLElement)#39 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "BRL" ["rate"]=> string(6) "3.2100" } } [3]=> object(SimpleXMLElement)#40 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CAD" ["rate"]=> string(6) "1.5244" } } [4]=> object(SimpleXMLElement)#41 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CHF" ["rate"]=> string(6) "1.2172" } } [5]=> object(SimpleXMLElement)#42 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CNY" ["rate"]=> string(6) "8.4564" } } [6]=> object(SimpleXMLElement)#43 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CZK" ["rate"]=> string(7) "27.3690" } } [7]=> object(SimpleXMLElement)#44 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "DKK" ["rate"]=> string(6) "7.4627" } } [8]=> object(SimpleXMLElement)#45 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "GBP" ["rate"]=> string(6) "0.8246" } } [9]=> object(SimpleXMLElement)#46 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "HKD" ["rate"]=> string(7) "10.6847" } } [10]=> object(SimpleXMLElement)#47 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "HRK" ["rate"]=> string(6) "7.6525" } } [11]=> object(SimpleXMLElement)#48 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "HUF" ["rate"]=> string(8) "311.1500" } } [12]=> object(SimpleXMLElement)#49 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "IDR" ["rate"]=> string(10) "15957.1100" } } [13]=> object(SimpleXMLElement)#50 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "ILS" ["rate"]=> string(6) "4.8055" } } [14]=> object(SimpleXMLElement)#51 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "INR" ["rate"]=> string(7) "85.1757" } } [15]=> object(SimpleXMLElement)#52 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "JPY" ["rate"]=> string(8) "140.2000" } } [16]=> object(SimpleXMLElement)#53 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "KRW" ["rate"]=> string(9) "1474.4700" } } [17]=> object(SimpleXMLElement)#54 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "LTL" ["rate"]=> string(6) "3.4528" } } [18]=> object(SimpleXMLElement)#55 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "MXN" ["rate"]=> string(7) "18.2977" } } [19]=> object(SimpleXMLElement)#56 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "MYR" ["rate"]=> string(6) "4.5049" } } [20]=> object(SimpleXMLElement)#57 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "NOK" ["rate"]=> string(6) "8.2485" } } [21]=> object(SimpleXMLElement)#58 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "NZD" ["rate"]=> string(6) "1.6411" } } [22]=> object(SimpleXMLElement)#59 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "PHP" ["rate"]=> string(7) "61.6390" } } [23]=> object(SimpleXMLElement)#60 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "PLN" ["rate"]=> string(6) "4.1865" } } [24]=> object(SimpleXMLElement)#61 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "RON" ["rate"]=> string(6) "4.5183" } } [25]=> object(SimpleXMLElement)#62 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "RUB" ["rate"]=> string(7) "49.7510" } } [26]=> object(SimpleXMLElement)#63 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "SEK" ["rate"]=> string(6) "8.8603" } } [27]=> object(SimpleXMLElement)#64 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "SGD" ["rate"]=> string(6) "1.7469" } } [28]=> object(SimpleXMLElement)#65 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "THB" ["rate"]=> string(7) "44.6290" } } [29]=> object(SimpleXMLElement)#66 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "TRY" ["rate"]=> string(6) "3.0520" } } [30]=> object(SimpleXMLElement)#67 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "USD" ["rate"]=> string(6) "1.3768" } } [31]=> object(SimpleXMLElement)#68 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "ZAR" ["rate"]=> string(7) "14.9180" } } } } } [1]=> object(SimpleXMLElement)#3 (2) { ["@attributes"]=> array(1) { ["time"]=> string(10) "2014-03-04" } ["Cube"]=> array(32) { [0]=> object(SimpleXMLElement)#36 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "AUD" ["rate"]=> string(6) "1.5392" } } [1]=> object(SimpleXMLElement)#68 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "BGN" ["rate"]=> string(6) "1.9558" } } [2]=> object(SimpleXMLElement)#67 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "BRL" ["rate"]=> string(6) "3.2100" } } [3]=> object(SimpleXMLElement)#66 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CAD" ["rate"]=> string(6) "1.5244" } } [4]=> object(SimpleXMLElement)#65 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CHF" ["rate"]=> string(6) "1.2172" } } [5]=> object(SimpleXMLElement)#64 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CNY" ["rate"]=> string(6) "8.4564" } } [6]=> object(SimpleXMLElement)#63 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CZK" ["rate"]=> string(7) "27.3690" } } [7]=> object(SimpleXMLElement)#62 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "DKK" ["rate"]=> string(6) "7.4627" } } [8]=> object(SimpleXMLElement)#61 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "GBP" ["rate"]=> string(6) "0.8246" } } [9]=> object(SimpleXMLElement)#60 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "HKD" ["rate"]=> string(7) "10.6847" } } [10]=> object(SimpleXMLElement)#59 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "HRK" ["rate"]=> string(6) "7.6525" } } [11]=> object(SimpleXMLElement)#58 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "HUF" ["rate"]=> string(8) "311.1500" } } [12]=> object(SimpleXMLElement)#57 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "IDR" ["rate"]=> string(10) "15957.1100" } } [13]=> object(SimpleXMLElement)#56 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "ILS" ["rate"]=> string(6) "4.8055" } } [14]=> object(SimpleXMLElement)#55 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "INR" ["rate"]=> string(7) "85.1757" } } [15]=> object(SimpleXMLElement)#54 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "JPY" ["rate"]=> string(8) "140.2000" } } [16]=> object(SimpleXMLElement)#53 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "KRW" ["rate"]=> string(9) "1474.4700" } } [17]=> object(SimpleXMLElement)#52 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "LTL" ["rate"]=> string(6) "3.4528" } } [18]=> object(SimpleXMLElement)#51 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "MXN" ["rate"]=> string(7) "18.2977" } } [19]=> object(SimpleXMLElement)#50 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "MYR" ["rate"]=> string(6) "4.5049" } } [20]=> object(SimpleXMLElement)#49 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "NOK" ["rate"]=> string(6) "8.2485" } } [21]=> object(SimpleXMLElement)#48 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "NZD" ["rate"]=> string(6) "1.6411" } } [22]=> object(SimpleXMLElement)#47 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "PHP" ["rate"]=> string(7) "61.6390" } } [23]=> object(SimpleXMLElement)#46 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "PLN" ["rate"]=> string(6) "4.1865" } } [24]=> object(SimpleXMLElement)#45 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "RON" ["rate"]=> string(6) "4.5183" } } [25]=> object(SimpleXMLElement)#44 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "RUB" ["rate"]=> string(7) "49.7510" } } [26]=> object(SimpleXMLElement)#43 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "SEK" ["rate"]=> string(6) "8.8603" } } [27]=> object(SimpleXMLElement)#42 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "SGD" ["rate"]=> string(6) "1.7469" } } [28]=> object(SimpleXMLElement)#41 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "THB" ["rate"]=> string(7) "44.6290" } } [29]=> object(SimpleXMLElement)#40 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "TRY" ["rate"]=> string(6) "3.0520" } } [30]=> object(SimpleXMLElement)#39 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "USD" ["rate"]=> string(6) "1.3768" } } [31]=> object(SimpleXMLElement)#38 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "ZAR" ["rate"]=> string(7) "14.9180" } } } } [2]=> object(SimpleXMLElement)#4 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "AUD" ["rate"]=> string(6) "1.5392" } } [3]=> object(SimpleXMLElement)#5 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "BGN" ["rate"]=> string(6) "1.9558" } } [4]=> object(SimpleXMLElement)#6 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "BRL" ["rate"]=> string(6) "3.2100" } } [5]=> object(SimpleXMLElement)#7 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CAD" ["rate"]=> string(6) "1.5244" } } [6]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CHF" ["rate"]=> string(6) "1.2172" } } [7]=> object(SimpleXMLElement)#9 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CNY" ["rate"]=> string(6) "8.4564" } } [8]=> object(SimpleXMLElement)#10 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "CZK" ["rate"]=> string(7) "27.3690" } } [9]=> object(SimpleXMLElement)#11 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "DKK" ["rate"]=> string(6) "7.4627" } } [10]=> object(SimpleXMLElement)#12 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "GBP" ["rate"]=> string(6) "0.8246" } } [11]=> object(SimpleXMLElement)#13 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "HKD" ["rate"]=> string(7) "10.6847" } } [12]=> object(SimpleXMLElement)#14 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "HRK" ["rate"]=> string(6) "7.6525" } } [13]=> object(SimpleXMLElement)#15 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "HUF" ["rate"]=> string(8) "311.1500" } } [14]=> object(SimpleXMLElement)#16 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "IDR" ["rate"]=> string(10) "15957.1100" } } [15]=> object(SimpleXMLElement)#17 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "ILS" ["rate"]=> string(6) "4.8055" } } [16]=> object(SimpleXMLElement)#18 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "INR" ["rate"]=> string(7) "85.1757" } } [17]=> object(SimpleXMLElement)#19 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "JPY" ["rate"]=> string(8) "140.2000" } } [18]=> object(SimpleXMLElement)#20 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "KRW" ["rate"]=> string(9) "1474.4700" } } [19]=> object(SimpleXMLElement)#21 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "LTL" ["rate"]=> string(6) "3.4528" } } [20]=> object(SimpleXMLElement)#22 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "MXN" ["rate"]=> string(7) "18.2977" } } [21]=> object(SimpleXMLElement)#23 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "MYR" ["rate"]=> string(6) "4.5049" } } [22]=> object(SimpleXMLElement)#24 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "NOK" ["rate"]=> string(6) "8.2485" } } [23]=> object(SimpleXMLElement)#25 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "NZD" ["rate"]=> string(6) "1.6411" } } [24]=> object(SimpleXMLElement)#26 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "PHP" ["rate"]=> string(7) "61.6390" } } [25]=> object(SimpleXMLElement)#27 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "PLN" ["rate"]=> string(6) "4.1865" } } [26]=> object(SimpleXMLElement)#28 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "RON" ["rate"]=> string(6) "4.5183" } } [27]=> object(SimpleXMLElement)#29 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "RUB" ["rate"]=> string(7) "49.7510" } } [28]=> object(SimpleXMLElement)#30 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "SEK" ["rate"]=> string(6) "8.8603" } } [29]=> object(SimpleXMLElement)#31 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "SGD" ["rate"]=> string(6) "1.7469" } } [30]=> object(SimpleXMLElement)#32 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "THB" ["rate"]=> string(7) "44.6290" } } [31]=> object(SimpleXMLElement)#33 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "TRY" ["rate"]=> string(6) "3.0520" } } [32]=> object(SimpleXMLElement)#34 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "USD" ["rate"]=> string(6) "1.3768" } } [33]=> object(SimpleXMLElement)#35 (1) { ["@attributes"]=> array(2) { ["currency"]=> string(3) "ZAR" ["rate"]=> string(7) "14.9180" } } }