var_dump returns everything on the same line

Asked

Viewed 1,974 times

4

http://prntscr.com/c0esw9

Hello folks my php is returning the var_dump this way what can be?

I use shaman in Ubuntu.

who can help very much thank you.

  • 6

    Try to use: echo '<pre>'; var_dump($variavel); echo '</pre>';

1 answer

6


You are probably viewing through the browser.

Brower renders HTML. The output of var_dump() returns in plain text. In plain text, the line break is r or n. The browser does not render line break.

To have the friendliest look with line breaks, do this:

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

This will cause the content to be displayed in text format.

Another way is to do nothing. Simply open the source code of the page. In Chrome, press CTRL+U.

  • thanks was that same fixed the code , I thought it was something with my php or version , but it was just a silly rsrs obg code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.