How do I dump arrays in a nice orderly fashion?

Posted by George on Stack Overflow See other posts from Stack Overflow or by George
Published on 2013-11-10T03:35:31Z Indexed on 2013/11/10 3:53 UTC
Read the original article Hit count: 167

Filed under:
|
|

Whenever I use print_r or var_dump they come out all sloppy and in one line instead of formatted like I see so many people and the actual php.net site being able to achieve. What do I do to get them like this -

Array
(
    [a] => apple
    [b] => banana
    [c] => Array
        (
            [0] => x
            [1] => y
            [2] => z
        )
)

Instead of this

Array([a] => apple [b] => banana [c] => Array ( [0] => x [1] => y [2] => z ))

(Pretty sure it comes out even messier than that I was just deleting whitespace by hand.)

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays