0

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

Limon
  • 1,772
  • 7
  • 32
  • 61

3 Answers3

3

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.

Marcello Verona
  • 540
  • 1
  • 6
  • 10
  • Yes, but No one is answering me the question. How come I could see like in the photo before and didn't have to use xdebug or use the
     tag?
    – Limon Nov 28 '14 at 21:58
  • Before you used it without knowing it :) Probably in the new wamp version isn't enabled – Marcello Verona Nov 28 '14 at 22:09
  • XDEBUG is installed by default on WAMPServer and has been for many versions. Possibly you have disabled it somehow. – RiggsFolly Nov 28 '14 at 22:53
2

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.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
0

You can do:

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

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

KIKO Software
  • 15,283
  • 3
  • 18
  • 33
  • I believe the pre tags will cause his output to have HTML encoded strings all over (because of the colors), making it even harder to read. EDIT: Scratch this, was confused. This is a good starting point for you, Limon! – Mikel Bitson Nov 28 '14 at 21:39
  • No, currently the output of Limon is just plain text, not nicely formatted, hence preformatting will convert line returns to visible new lines. – KIKO Software Nov 28 '14 at 21:41
  • @MikelBitson I would like to know how come I could see my code like in the picture, didn't have to put echo '
    '; for that
    – Limon Nov 28 '14 at 21:45
  • @KIKOSoftware Why am I not be able to see var_dump result as I used to do? – Limon Nov 28 '14 at 21:46
  • You now see the standard behaviour of PHP. To get nicely colored and formatted output you must have installed something on your old server, or it was installed for you (without you realizing it). – KIKO Software Nov 28 '14 at 22:00
  • @KIKOSoftware ohh...maybe..who knows. Now I have installed xdebug and working fine, thanks – Limon Nov 28 '14 at 22:06