PHP: Dump _ALL_ the data to the browser

Sometimes its useful to show data received / processed through PHP in the browser for debugging purposes. Yes you can use Firebug or some of those fancy debugging classes, but maybe you just want to view that damn array quickly 🙂

Use this:

function dumpMe($arr) {
    echo str_replace(array("\n", ' '), array('
', ' '), print_r($arr, true)) . '
';
}

 

Published by

KB

I'm a student at TUM in Computer Science & Pizza eating. Passionate for SRE, beautiful Code and Club Mate.