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); ?> |
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); ?> |
float(3.1) bool(true)
Recommended Posts:
- What is the difference between display: inline and display: inline-block in CSS?
- How do I get PHP errors to display?
- CSS | Display property
- Display div element on hovering over <a> tag using CSS
- How Facebook Display Ads for something you searched
- Display Property in Bootstrap with Examples
- HTML | DOM Style display Property
- Display a Resized and Cropped Image using CSS
- Neon Text Display Using HTML & CSS
- How to display HTML tags as plain text using PHP
- How to display div elements using Dropdown Menu in jQuery?
- How do you display JavaScript datetime in 12 hour AM/PM format?
- How to display bootstrap carousel with three post in each slide?
- How to add `style=display:“block”` to an element using jQuery?
- Display the number of links present in a document using JavaScript
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.



