How to xdebug var_dump to display full object/array ?

Debugging is necessary as committal to writing within the field of development. There would possibly occur a case once the developer must check data of a variable. A developer could print all the contents however PHP itself provides a way to try and do constant and similarly as checks the datatype.

Xdebug is the PHP extension that provides debugging and identification capabilities. It uses the debugging protocol. The correct data that Xdebug will give stack and performance traces in error messages with the full parameter to show for user outlined functions, operate name, file name, line indications, and support for member functions. It includes memory allocation & protection for infinite recursions.
Xdebug additionally provides identification data for PHP scripts, code coverage analysis and nice capabilities to correct your scripts interactively with a computer front-end program. Xdebug is additionally offered via the PHP Extension Community Library (PECL) – that is often pronounced as ‘pickle’.

The var_dump() function is employed to display the data of a couple of variables. It operates display structured data like the kind and worth of the given variable. Arrays and object square measure explored recursively with values indented to point out the structure.
var_dump – Dumps information about a variable.

Syntax:

void var_dump( $exp )

Parameters: This function accepts single parameter $exp which holds single variable or an expression containing many areas separated variables of any kind.



Return Type: This function has no return type. This function displays structured data concerning one or additional expressions that embrace its kind and price. Arrays and objects are explored recursively with values indented to point out the structure.

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
$a = array(1, 2, array("a", "b", "c"));
var_dump($a);
?>

chevron_right


Output:

array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  array(3) {
    [0]=>
    string(1) "a"
    [1]=>
    string(1) "b"
    [2]=>
    string(1) "c"
  }
}

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
$b = 3.1;
$c = true;
var_dump($b, $c);
?>

chevron_right


Output:

float(3.1)
bool(true)


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.