3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><paymentresponse><merchant><merchantid>1000001</merchantid><accountid>2000034</accountid></merchant><transaction><merchantref>yAq3ueCIDG1u3Q9Y2Tfs</merchantref><amount>1000</amount><currency>USD</currency><transactiontype>ECOMMERCE</transactiontype></transaction><status><code>SUCCESS</code><message>Operation successful</message><timestamp>2012-07-24T13:48:05+01:00</timestamp></status></paymentresponse>'; $data = (array) simplexml_load_string($xml); var_dump($data); var_dump(json_decode(json_encode($data),1));
Output for 5.2.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
array(3) { ["merchant"]=> object(SimpleXMLElement)#2 (2) { ["merchantid"]=> string(7) "1000001" ["accountid"]=> string(7) "2000034" } ["transaction"]=> object(SimpleXMLElement)#3 (4) { ["merchantref"]=> string(20) "yAq3ueCIDG1u3Q9Y2Tfs" ["amount"]=> string(4) "1000" ["currency"]=> string(3) "USD" ["transactiontype"]=> string(9) "ECOMMERCE" } ["status"]=> object(SimpleXMLElement)#4 (3) { ["code"]=> string(7) "SUCCESS" ["message"]=> string(20) "Operation successful" ["timestamp"]=> string(25) "2012-07-24T13:48:05+01:00" } } array(3) { ["merchant"]=> array(2) { ["merchantid"]=> string(7) "1000001" ["accountid"]=> string(7) "2000034" } ["transaction"]=> array(4) { ["merchantref"]=> string(20) "yAq3ueCIDG1u3Q9Y2Tfs" ["amount"]=> string(4) "1000" ["currency"]=> string(3) "USD" ["transactiontype"]=> string(9) "ECOMMERCE" } ["status"]=> array(3) { ["code"]=> string(7) "SUCCESS" ["message"]=> string(20) "Operation successful" ["timestamp"]=> string(25) "2012-07-24T13:48:05+01:00" } }
Output for 5.0.0 - 5.1.6
array(3) { ["merchant"]=> object(SimpleXMLElement)#2 (2) { ["merchantid"]=> string(7) "1000001" ["accountid"]=> string(7) "2000034" } ["transaction"]=> object(SimpleXMLElement)#3 (4) { ["merchantref"]=> string(20) "yAq3ueCIDG1u3Q9Y2Tfs" ["amount"]=> string(4) "1000" ["currency"]=> string(3) "USD" ["transactiontype"]=> string(9) "ECOMMERCE" } ["status"]=> object(SimpleXMLElement)#4 (3) { ["code"]=> string(7) "SUCCESS" ["message"]=> string(20) "Operation successful" ["timestamp"]=> string(25) "2012-07-24T13:48:05+01:00" } } Fatal error: Call to undefined function json_decode() in /in/p4NPJ on line 7
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_string() in /in/p4NPJ on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_string() in /in/p4NPJ on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_string() in /in/p4NPJ on line 5