Convert SimpleXMLElement to Array
Ok, I know this is simple, but it took me a while to realize this simple method to convert SimpleXMLElement to an array. (I even tempted to write a function to parse and convert the XML tree).
Its simple actually, to just just the default PHP functions
Its simple actually, to just just the default PHP functions
$xml = <tag>content</tag>
print_r(json_decode(json_encode($xml), TRUE));
Comments
Post a Comment