- var_dump: documentation ( source)
- json_decode: documentation ( source)
- simplexml_load_string: documentation ( source)
- json_encode: documentation ( source)
<?php
$xml = <<<EOS
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<paymentresponse>
<merchant>
<merchantid>10000001</merchantid>
<accountid>20000001</accountid>
</merchant>
<transaction>
<merchantref>Fh8F9fEpeK8qUFMHt0Vl</merchantref>
</transaction>
<status>
<code>SUCCESS</code>
<message>Request Successful</message>
<reasons>
<reason>VA1</reason>
</reasons>
<timestamp>2012-06-21T16:56:39.154+01:00</timestamp>
</status>
<requestkey>3b5bee9ffa8a446e8f30161516af1527</requestkey>
</paymentresponse>
EOS;
var_dump(json_decode(json_encode((array)simplexml_load_string($xml)), 1));