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

Kordian Bruck

I'm a TUM Computer Science Alumni. Pizza enthusiast. Passionate for SRE, beautiful Code and Club Mate. Currently working as an SRE at Google. Opinions and statements in this blog post are my own.

Leave a Reply