hard to read when doing var_dump

1.4k views Asked by At

I have recently installed the new wampserver 2.5 (with php 5.5.12) due to a problem I had with the wamp I had installed on my laptop.

The thing is that when doing var_dump the info is not displayed as it used to display, the new format is for example>

array(4) { ["title"]=> string(0) "" ["type"]=> array(3) { ["registered"]=> string(1) "1" ["prepay"]=> string(1) "2" ["preregistered"]=> string(1) "0" } ["date"]=> array(3) { ["age"]=> string(0) "" ["from"]=> string(0) "" ["to"]=> string(0) "" } ["number"]=> string(0) "" }

which is unreadable! How come I used to see before like this when doing a var_dump? I didn't have to user xdebug or anything like it, neither use the tags.. how do I fix this?

how I used to see when doing var_dump

3

There are 3 answers

1
RiggsFolly On BEST ANSWER

WAMPServer has come with XDEBUG configured for many version now.

With XDEBUG activated in WAMPServer 2.5 you will get a result that looks just like your picture, it is generated by XDEBUG, but when you deactivate XDEBUG, you will get the standard PHP output that you are complaining about.

Look at your php.ini file ( use the wampmanager menus to edit it )

wampmanager -> PHP -> php.ini

At the bottom you should see this section which activates XDEBUG

zend_extension = "d:/wamp/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5-5.5-vc11.dll"
;
[xdebug]
xdebug.remote_enable = off
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "d:/wamp/tmp"
xdebug.show_local_vars=0

Make sure you have not removed this or amended any configurations.

6
KIKO Software On

You can do:

echo '<pre>';
var_dump($variable);
echo '</pre>';

Which is preformatted output. Not colored as nicely as in your example.

3
Marcello Verona On

As KIKO Software wrote, with the <pre> tag you can read the output. Otherwise, to obtain the result you have posted as example, you need to install the xdebug module (useful for a lot of other things).

Please take a look: http://xdebug.org/

Another useful tool can be Krumo: http://krumo.sourceforge.net/ It's a tool very easy to use and powerful.