<?php
$str = '<ncresponse
orderID="120130414021640"
PAYID="BESALDOM 516A65F5E5E"
STATUS="4"
NCSTATUS="0"
NCERROR=""
NCERRORPLUS="Your transaction has been submitted for processing."
ACCEPTANCE="BINF-"
IPCTY=""
CCCTY=""
IDUsager="7884TSMA"
/>';
function parse_response($response) {
$xml = new SimpleXMLElement($response);
$arr = array();
foreach($xml->attributes() as $key => $value) {
$arr[(string)$key] = (string)$value;
}
return $arr;
}
var_dump(parse_response($str));