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.
var_dump() displays values along with data types as output. print_r() displays only value as output. It does not have any return type. It will return a value that is in string format.
The var_dump() function is used to dump information about a variable. This function displays structured information such as type and value of the given variable. Arrays and objects are explored recursively with values indented to show structure. This function is also effective with expressions.
var_dump prints out a detailed dump of a variable, including its type and the type of any sub-items (if it's an array or an object). print_r prints a variable in a more human-readable form: strings are not quoted, type information is omitted, array sizes aren't given, etc.
The var_dump equivalent in JavaScript? Simply, there isn't one. Prints an interactive listing of all properties of the object.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With