- Home
- Blog
- Contact
If you are trying to convert XML to an Array, then this is a snippet I have found useful in the past.
<?php
// Convert XML to Array
function xmlToArray($response){
$xml = simplexml_load_string($response);
$json = json_encode($xml);
$arr = json_decode($json,true);
return $arr;
}
Code language: HTML, XML (xml)
Hope this helps you. If you are having any issues please leave a comment below.