0

I am working on a script that takes uploaded INI files and converts them to a database. The INI files are quite poorly written and created loops inside themselves. I am first converting the INIs into arrays, nested in the way that they will be inserted into database tables. But this means I am having 4 levels and deeper of arrays. More than var_dump will show.

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

works, but it's not nicely formatted, and it's cumbersome, so I am hoping var_dump can be modified somehow to be allowed to go deeper. Is there such an option?

Thanks

-Edit, found the answer, it was a duplicate. Posting as a clarification to other searchers. Open your php.ini, find the section called [xdebug] add this to the end of the section xdebug.var_display_max_depth=-1

Trevor
  • 2,792
  • 1
  • 30
  • 43

2 Answers2

3

Or simply add this at your script:

ini_set('xdebug.var_display_max_depth', 99);
1

Keep in mind if you have xdebug installed it will limit the var_dump() output of array elements and object properties to 3 levels deep.

To change the default, edit your xdebug.ini file and add the folllowing line:

xdebug.var_display_max_depth=n

where n is your max level.

More information here: http://www.xdebug.org/docs/display

mehulmpt
  • 15,861
  • 12
  • 48
  • 88