Over a million developers have joined DZone.

Debugging SimpleXML Objects

·
AGRH@!! SimpleXML bites the big one -- you can't even var_dump it to examine the contents and the controls are terrible. Luckily, you can convert it for debugging:


$sxml = simplexml_load_string($data);
// .. much hate between then and now... //
debugsxml($sxml);


function debugsxml($sxml) {
    $dom = dom_import_simplexml($sxml);
    printArray($dom);
}

function printArray($array){
    echo '
';
    print_r($array);
    echo '
'; }
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}