How to get xdebug var_dump to show full object/array How to get xdebug var_dump to show full object/array php php

How to get xdebug var_dump to show full object/array


These are configurable variables in php.ini:

; with sane limitsxdebug.var_display_max_depth = 10xdebug.var_display_max_children = 256xdebug.var_display_max_data = 1024 ; with no limits; (maximum nesting is 1023)xdebug.var_display_max_depth = -1 xdebug.var_display_max_children = -1xdebug.var_display_max_data = -1 

Of course, these may also be set at runtime via ini_set(), useful if you don't want to modify php.ini and restart your web server but need to quickly inspect something more deeply.

ini_set('xdebug.var_display_max_depth', 10);ini_set('xdebug.var_display_max_children', 256);ini_set('xdebug.var_display_max_data', 1024);

Xdebug settings are explained in the official documentation.


I know this is a super old post, but I figured this may still be helpful.

If you're comfortable with reading json format you could replace your var_dump with:

return json_encode($myvar);

I've been using this to help troubleshoot a service I've been building that has some deeply nested arrays. This will return every level of your array without truncating anything or requiring you to change your php.ini file.

Also, because the json_encoded data is a string it means you can write it to the error log easily

error_log(json_encode($myvar));

It probably isn't the best choice for every situation, but it's a choice!


I know this is late but it might be of some use:

echo "<pre>";print_r($array);echo "</pre>";