How to debug or explore an unknown object or array too big for Drupal's debug()?
Devel

Devel module provides dd() command which is very useful for dumping very large object. Just run dd($vars) in the middle of code, it'll dump any object to the temporary file in your Drupal temp folder (temporary://drupal_debug.txt).



XDebug

Use XDebug PHP extension, so var_dump() will be replaced by xdebug_var_dump() so your big dump won't consist circular dependencies and would be limited only by specific depth.



Alternatively use TVarDumper, array_slice, serialize or json_encode, so check below for further details:


Using print_r and var_dump with circular reference at SO