In the previous question, I asked for an alternative implementation of var_dump that allowed limiting the output of the depth of nested arrays.
Abhishek answered the question. But that function works only on nested arrays. It does't work on object graphs.
How can a var_dump
implementation work on object graphs and limit the output of the depth of nested objects?
By far the easiest solution is to install the xdebug extension (which is a good idea anyway). It overrides var_dump
with a version which limits output to a configurable depth.