I personally use var_dump
, but lots of people like print_r
.
What does everyone use? Pros and Cons?
Does someone have a special home brew function of their own?
I use print_r()
because I like the pretty array structure... but var_dump
does give you a bit more information (like types)
$obj = (object) array(1, 2, 3);
// output of var_dump:
object(stdClass)#1 (3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
// output of print_r
stdClass Object
(
[0] => 1
[1] => 2
[2] => 3
)
I always use the Xdebug extended var_dump. It gives out a lot of verbose output.
See: http://xdebug.org/docs/display for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With