- var_dump: documentation ( source)
- simplexml_load_string: documentation ( source)
- json_encode: documentation ( source)
<?php
$xml = "<root><node><node>stuff</node><node>stuff</node><anothernode>more stuff</anothernode></node></root>";
$xml = simplexml_load_string($xml);
var_dump(json_encode($xml));