How do you get readable display XML in the browser with PHP


Unfortunately, XML the browser will usually “swallowed”. Then only the data remain and the programmer watching the tube and must rum eggs with Firebug.

If you are a show the XML eifnach wants to let, There are following PHP trick with the function htmlentities(), the u.a. the “<” and “>”- Escaped characters, and the very practical own dump() Function:

dump(htmlentities($response));
//die ultimative Debug-Funktion
function dump($var)
{
    echo "<pre><div align='left'>";
    print_r($var);
    echo "</div></pre>";
}

Thus, the output is readable formatted:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<env:Envelope>
    <env:Header/>
    <env:Body env:encodingStyle="">
    </env:Body>
</env:Envelope>