How xdebug changes var_dump
Aug 25, 2020
PHP
xdebug
var_dump
Thing you want to do
The var_dump display changed after installing xdebug. I checked specifically how it would change.
#Environment (including items not related to this work)
- MacBookPro (macOS Catalina 10.15.5)
- PHPStorm2020.2
- docker desktop2.2.0.3
- cakephp4.1.2
- xdebug2.9.6
Implementation
$test = ['a' =>'apple','b' =>'bed','c' => ['cat','cookie']];
var_dump($test);
Browser display when xdebug is not set
All are displayed in one line. It’s hard to see.
Browser display when xdebug is set
- var_dump description file, line is displayed
- Automatic line breaks
- value is colored
Supplement
Since uninstalling xdebug was a hassle, I set the following and checked.
xdebug.overload_var_dump = 0
#Remarks It may be more efficient if you set xdebug.
#Reference There are many other things you can do by looking at the manual settings. https://xdebug.org/docs/all_settings