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

$xml = <tag>content</tag>
print_r(json_decode(json_encode($xml), TRUE));

Comments

Popular posts from this blog

225019099301.apps.googleusercontent.com

Backup MySQL to Azure Storage in 30 Seconds

Generate GoDaddy SSL Certificate (.crt) for Azure Websites (.pfx)