A Cleaner Gentler PHP Variable Dump

6 January, 2021

Sure. Some structures, like an object with member arrays, will have you in a straight-jacket long before you determine where a particular value falls within the structure and how you should construct a reference to it.

Next time, try this:

$x = [['apple','orange','banana'],['blueberry','raspberry','boysenberry']];
print('<pre>').print_r($x,1).('<pre>');

 

The results are astonishingly different...

Array
(
    [0] => Array
        (
            [0] => apple
            [1] => orange
            [2] => banana
        )

    [1] => Array
        (
            [0] => blueberry
            [1] => raspberry
            [2] => boysenberry
        )

)

 

Login or Register to Comment!