How do I get all of elements with var_dump
?
I have a huge array but var_dump
prints only the first x elemets, and I need all of them to check if my sql is correct.
Asked
Active
Viewed 3.0k times
13
-
2have you though of `echo ' – ';` ? Or `foreach($array as $v){var_dump($v);}`?HamZa Apr 29 '13 at 12:00
-
1Possible duplicate of http://stackoverflow.com/q/9998490/ – HamZa Apr 29 '13 at 12:03
-
The other question is very focused on xdebug, where as this just wants an alternative to the default var_dump. – Andrew Apr 02 '19 at 13:09
3 Answers
36
try
echo '<pre>';
print_r($your_array);
echo '</pre>';
This will not show you type/size of the array elements as var_dump but will show you full array.

Maulik Vora
- 2,544
- 5
- 28
- 48
3
Use print_r
:
<pre>
<?php
print_r($var);
?>
</pre>
It's a good way to see your array. The pre
element formats it nice and readable.

Richard de Wit
- 7,102
- 7
- 44
- 54