Skip to content

Instantly share code, notes, and snippets.

@stefanocudini
Created July 25, 2012 17:24
Show Gist options
  • Select an option

  • Save stefanocudini/3177389 to your computer and use it in GitHub Desktop.

Select an option

Save stefanocudini/3177389 to your computer and use it in GitHub Desktop.
convert xml file to array object in one line
<?
function xml2array($xml)
{
return (empty($xml) ? array() : json_decode(json_encode(simplexml_load_string($xml)),true) );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment