X

How to beautify a print_r in PHP?


function console_print($obj)
{
$js = json_encode($obj);
print_r('<script>console.log('.$js.')</script>');
}
function prettyPrint($a, $t='pre') {echo "<$t>".print_r($a,1)."</$t>";}
// https://github.com/kint-php/kint consider using this

Bad Joe: