Skip to content

Instantly share code, notes, and snippets.

@vanderson139
Created July 29, 2019 22:24
Show Gist options
  • Select an option

  • Save vanderson139/4d3c6c3f78f3638d236d7ca0522fd338 to your computer and use it in GitHub Desktop.

Select an option

Save vanderson139/4d3c6c3f78f3638d236d7ca0522fd338 to your computer and use it in GitHub Desktop.
Convert XML string to array
$xml = preg_replace('/(<\/?)(\w+):([^>]*>)/', '$1$2$3', $string);
$xml = simplexml_load_string($xml);
$json = json_encode($xml);
$responseArray = json_decode($json,true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment