Level 10
Wrap it in pre tags:
print("<pre>" . PHP_EOL);
var_dump($var);
print("</pre>" . PHP_EOL);
I think that some debuggers will do that for you and format it with CSS. https://xdebug.org/docs/stack_trace
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
php var_dump doesn't style dumped data , instead converts to string and outputs like print_r does .
Please or to participate in this conversation.