Page 1 of 1
setup print_r() look???
Posted: Wed Jun 07, 2006 12:46 am
by pedrotuga
my print_r() output somtehing like this:
Code: Select all
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 7 )
in the manual, and in code i see here and there it usually gives this:
Code: Select all
Array (
[0] => 1
[1] => 2
[2] => 3
[3] => 7
)
which is far so much easyer to read....
can i setup my conf somwhere so i have a similar result?
Posted: Wed Jun 07, 2006 12:48 am
by n00b Saibot
either use
Code: Select all
echo '<pre>';
print_r($arrName);
echo '</pre>';
or
Code: Select all
echo nl2br(print_r($arrName, TRUE));
Posted: Wed Jun 07, 2006 12:53 am
by Christopher
I think many programmers use some variation of this:
Code: Select all
function dump($value, $label='') {
echo $label . '<pre>' . print_r($value, 1) . '</pre>';
}
I tend to put it in the config.php file on the development site.
Posted: Wed Jun 07, 2006 12:54 am
by n00b Saibot
exactly

Re: setup print_r() look???
Posted: Wed Jun 07, 2006 9:25 am
by Roja
pedrotuga wrote:my print_r() output somtehing like this:
Code: Select all
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 7 )
in the manual, and in code i see here and there it usually gives this:
Code: Select all
Array (
[0] => 1
[1] => 2
[2] => 3
[3] => 7
)
which is far so much easyer to read....
can i setup my conf somwhere so i have a similar result?
Actually, if you view source, it is outputting the latter. Your browser is the one mangling the output to look like the first one.
