Friday, October 10, 2025
HomeLanguagesHow to xdebug var_dump to display full object/array ?

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:




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


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:




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


Output:

float(3.1)
bool(true)
RELATED ARTICLES

Most Popular

Dominic
32348 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6715 POSTS0 COMMENTS
Nicole Veronica
11878 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6837 POSTS0 COMMENTS
Ted Musemwa
7096 POSTS0 COMMENTS
Thapelo Manthata
6791 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS