I've also researched this issue and not found the right answer. This doesn't work for me:
echo '<pre>' . var_dump($variable) . '</pre>';
This will not provide a nice display of the array for me, with line breaks (I'm using Firefox 31.3.0)
However, after some experimentation, this solved the problem (notice the php is closed at first):
... ?> <pre><?php echo var_dump($variable) ?></pre> <?php ...
This solves the problem and displays a nice, easy-to-read array for me on my browser. You see how the tags are not wrapped in PHP; only the echo var_dump part is.