Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get xdebug var_dump to show full object/array

Tags:

php

xdebug

I am using xdebug (php_xdebug-2.1.2-5.3-vc9.dll) on WAMP. When I use var_dump on a large object or variable it does not show the full variable.

array 'node' =>    array     'my_form' =>        array         'form' =>            array             ... 

Without xdebug it shows as should be expected. I looked at the documentation but did not see a solution. Does anyone know how I can fix this so xdebug var_dump shows the full object?

like image 902
dm03514 Avatar asked Apr 03 '12 17:04

dm03514


People also ask

What is the difference between Var_dump () and Print_r ()?

var_dump() displays values along with data types as output. print_r() displays only value as output. It does not have any return type. It will return a value that is in string format.

Why Var_dump () is preferable over Print_r ()?

It's too simple. The var_dump() function displays structured information about variables/expressions including its type and value. Whereas The print_r() displays information about a variable in a way that's readable by humans. Example: Say we have got the following array and we want to display its contents.

What value will Var_dump show that Echo will not show?

The var-dump is display the datatype as well as value while echo only display the value. Explanation: In Php the var-dump function is used for displaying the datatype as well the value . The var-dump () does not return anythings it means there is no datatype of var-dump() function.


1 Answers

These are configurable variables in php.ini:

; with sane limits xdebug.var_display_max_depth = 10 xdebug.var_display_max_children = 256 xdebug.var_display_max_data = 1024    ; with no limits ; (maximum nesting is 1023) xdebug.var_display_max_depth = -1  xdebug.var_display_max_children = -1 xdebug.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.

like image 125
Michael Berkowski Avatar answered Oct 01 '22 21:10

Michael Berkowski