PHP: Collapsing Object In Var_dumpJun 25th, 2013
var_dump() in an object-oriented world, often the output is too big because of objects and therefore not readable. Here a function to collapse objects, and make debugging easier.
To collapse an object, we replace it by a string with its classname:
We recursively traverse the data structure, replacing each object by a string.
var_dump on the data structure with collapsed objects will produce a more readable output: