Skip to content

Instantly share code, notes, and snippets.

@davidgolding
Created July 7, 2011 16:17
Show Gist options
  • Save davidgolding/1069880 to your computer and use it in GitHub Desktop.
Save davidgolding/1069880 to your computer and use it in GitHub Desktop.
XML to PHP array or JSON string in PHP
$json = json_encode(new SimpleXMLElement($xmlString, LIBXML_NOCDATA));
$xmlArray = json_decode($json, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment