Reputation: 1624
Is there a php.ini setting (or some other setting) that will cause print_r and var_dump output to be automatically formatted as though I had explicitly placed a <pre>
tag before such an output statement?
Upvotes: 1
Views: 453
Reputation: 7853
I don't know of any way to do this within PHP but I know xdebug replaces PHP's normal var_dump and it looks pretty awesome.
Here's an example
$object = new stdClass();
$object->xdebug = 'http://www.xdebug.org/';
$object->vardump = 'Looks awesome now';
$int = 1;
$str = 'Stack Overflow';
$array = array(0 => 'foo', 1 => 'bar', '2' => 'baz');
var_dump($object);
var_dump($int);
var_dump($str);
var_dump($array);
results in
Upvotes: 1