The function var_dump() displays structured information (type and value) about one or more expressions/variables. Arrays and objects are explored recursively with values indented to show structure. All public, private and protected properties of objects will be returned in the output.
4. Which is true about var_dump() function? Explanation: var_dump() cuts off loop after getting the same element three times is true about var_dump() function.
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 dumps information about one or more variables. The information holds type and value of the variable(s).
A full year of time and labor after asking this, I've finally open sourced my version of var_dump, Kint. Read about it in the project page, or directly in github.
Here's a screenshot:
Sorry for the plug :)
EDIT: I'd just like to remind the commenters, that this is not a support forum, if you're having problems/want a feature, please file an issue. Support requesting comments will be flagged for deletion.
My prefered on is the var_dump
function, as provided by the Xdebug extension : just install the extension (easy, both on windows and Linux), and var_dump
gets a better output :
And a quick screenshot :
And, of course, Xdebug brings loads of other usefull stuff, like remote debugging (i.e. graphical debugging of your PHP application, in Eclipse PDT for instance), profiling, ...
I wrote my own: REF (demo):
Plans are to add text-only rendering, and display info about the input expression like Kint does...
Here's mine, which I use inline, very useful:
$pretty = function($v='',$c=" ",$in=-1,$k=null)use(&$pretty){$r='';if(in_array(gettype($v),array('object','array'))){$r.=($in!=-1?str_repeat($c,$in):'').(is_null($k)?'':"$k: ").'<br>';foreach($v as $sk=>$vl){$r.=$pretty($vl,$c,$in+1,$sk).'<br>';}}else{$r.=($in!=-1?str_repeat($c,$in):'').(is_null($k)?'':"$k: ").(is_null($v)?'<NULL>':"<strong>$v</strong>");}return$r;};
echo $pretty($some_variable);
You are looking for Krumo (Warning, Chrome alerts for Malware).
To put it simply, Krumo is a replacement for print_r() and var_dump(). By definition Krumo is a debugging tool (initially for PHP4/PHP5, now for PHP5 only), which displays structured information about any PHP variable.
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