- json_decode: documentation ( source)
- simplexml_load_string: documentation ( source)
- print_r: documentation ( source)
- json_encode: documentation ( source)
<?php
$xml = new SimpleXMLElement('<root><elements attr="test"><el>test1</el><el>test2</el><el test_attr="123">test3</el></elements></root>');
print_r(json_decode(json_encode((array) simplexml_load_string($xml)), 1));