Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get all elements with var_dump? [duplicate]

Tags:

php

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.

like image 762
csaron92 Avatar asked Apr 29 '13 11:04

csaron92


People also ask

Why Var_dump () is preferable over Print_r ()?

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.

What is Var_dump () function explain with example?

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.

What is the difference between Echo print Print_r and Var_dump?

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.

Is there a Var_dump in JavaScript?

The var_dump equivalent in JavaScript? Simply, there isn't one. Prints an interactive listing of all properties of the object.


2 Answers

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.

like image 154
Maulik Vora Avatar answered Sep 19 '22 05:09

Maulik Vora


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.

like image 38
Richard de Wit Avatar answered Sep 18 '22 05:09

Richard de Wit