What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.



var_dump — Displays detailed information about one or more variables.


void var_dump(variable[, another_variable][, . . .]);
mixed variable: Variable for which you want to display information
mixed another_variable (optional): Another variable
mixed . . . (optional): ...




var_dump() displays information about variables in a simple, readable format. This function is very useful when debugging - providing a simple and easy way to display the current contents of one or more variables.

For simple scalar variables (such asbooleans,integers,strings, anddoubles), the type of the variable is printed, followed by an opening bracket, the value contained in the variable, and a closing bracket.

Resource pointers have their type (resource), ID number (such as 1, 2, or 45) and type of resource (such as dirorfile) displayed. The ID number assigned to a resource pointer reflects the order in which the resource pointer was created. (For example, the fifth resource pointer in a script has an ID number of 5.)

Arrays are printed as a list of keys and values, and have their typearray) printed at the top of the list.

Objects are handled in a fashion similar to that of arrays. The class of which the object is an instance is displayed, followed by the typeobject). After this, a list of the object's member variables is printed.


Unlike print_r() , var_dump() can deal with self-referencing data structures.


PHP Version: 3.0.5+, 4+

See also



Example 1411. Simple use of var_dump() for debugging

// Use var_dump() to display the contents of the $HTTP_POST_VARS array
// if a query fails
mysql_query ("SELECT * FROM db_table WHERE ID = '$HTTP_POST_VARS[user]'")
    or var_dump ($HTTP_POST_VARS);

Example 1412. Show how var_dump() displays information about variables

// Define a simple class for use in testing
class _3D_point {
    var $x = 0;
    var $y = 0;
                var $z = 0;

// Make a list of variables to pass to var_dump
$list_of_variables = array (
    'double' => 1E-206,
    'int' => 0xFFFFFF,
    'string' => "\"It's not th' bread, Bone! It's th' GITCHY FEELIN'\" - Gran'ma Ben",
    'array' => array ('money' => 'greed', 'politics' => 'corruption'),
    'object' => new _3D_point (),
    'resource' => opendir ('.')

foreach ($list_of_variables as $value){
    var_dump ($value);
    print "\n\n";

PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at The authors of this book have elected not to choose any options under the OPL. This online book was obtained from and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.