Is there any more elegant way to escape SimpleXML attributes to an array?
$result = $xml->xpath( $xpath ); $element = $result[ 0 ]; $attributes = (array)
You could convert the whole xml document into an array:
$array = json_decode(json_encode((array) simplexml_load_string("{$xml}")), true);
For more information see: https://github.com/gaarf/XML-string-to-PHP-array