Skip to content

Instantly share code, notes, and snippets.

@Guley
Created May 29, 2018 06:24
Show Gist options
  • Save Guley/3a93b175c7d929e0d5523d560293413f to your computer and use it in GitHub Desktop.
Save Guley/3a93b175c7d929e0d5523d560293413f to your computer and use it in GitHub Desktop.
$buffer ='<xml><item><id>1</id><name>Test</name></item></xml>';
$xml = new SimpleXMLElement($buffer);
$data = json_encode($xml, JSON_PRETTY_PRINT);
$data2 = json_decode($data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment