How to see full content of long strings with var_dump() in PHP

You are using xdebug, which overloads the default var_dump() to give you prettier and more configurable output. By default, it also limits how much information is displayed at one time. To get more output, you should change some settings.

Add this to the top of your script:

ini_set("xdebug.var_display_max_children", '-1');
ini_set("xdebug.var_display_max_data", '-1');
ini_set("xdebug.var_display_max_depth", '-1');

From the docs:

xdebug.var_display_max_children

Type: integer, Default value: 128

Controls the amount of array children and object's properties are shown when variables are displayed with either xdebug_var_dump(), xdebug.show_local_vars or through Function Traces.

To disable any limitation, use -1 as value.

This setting does not have any influence on the number of children that is send to the client through the Remote Debugging feature.

xdebug.var_display_max_data

Type: integer, Default value: 512

Controls the maximum string length that is shown when variables are displayed with either xdebug_var_dump(), xdebug.show_local_vars or through Function Traces.

To disable any limitation, use -1 as value.

This setting does not have any influence on the number of children that is send to the client through the Remote Debugging feature.

xdebug.var_display_max_depth

Type: integer, Default value: 3

Controls how many nested levels of array elements and object properties are when variables are displayed with either xdebug_var_dump(), xdebug.show_local_vars or through Function Traces.

The maximum value you can select is 1023. You can also use -1 as value to select this maximum number.

This setting does not have any influence on the number of children that is send to the client through the Remote Debugging feature.


Sometimes, using var_dump might be very tedious when working with long strings. Instead outputing the result on the browser, you can use the terminal. Another solution is to output the result on a text file using file_put_contents or similar. Then open the file and check the result.