Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

var_dump(3) [php man page]

VAR_DUMP(3)								 1							       VAR_DUMP(3)

var_dump - Dumps information about a variable

SYNOPSIS
void var_dump (mixed $expression, [mixed $...]) DESCRIPTION
This function displays structured information about one or more expressions that includes its type and value. 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 unless the object implements a __debugInfo() method (implemented in PHP 5.6.0). Tip As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example). PARAMETERS
o $expression - The variable you want to dump. RETURN VALUES
No value is returned. EXAMPLES
Example #1 var_dump(3) example <?php $a = array(1, 2, array("a", "b", "c")); var_dump($a); ?> The above example will output: array(3) { [0]=> int(1) [1]=> int(2) [2]=> array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } } <?php $b = 3.1; $c = true; var_dump($b, $c); ?> The above example will output: float(3.1) bool(true) SEE ALSO
print_r(3), debug_zval_dump(3), var_export(3), __debugInfo(). PHP Documentation Group VAR_DUMP(3)

Check Out this Related Man Page

ARRAYACCESS(3)								 1							    ARRAYACCESS(3)

The ArrayAccess interface

INTRODUCTION
Interface to provide accessing objects as arrays. INTERFACE SYNOPSIS
ArrayAccess ArrayAccess Methods o abstractpublic boolean ArrayAccess::offsetExists (mixed $offset) o abstractpublic mixed ArrayAccess::offsetGet (mixed $offset) o abstractpublic void ArrayAccess::offsetSet (mixed $offset, mixed $value) o abstractpublic void ArrayAccess::offsetUnset (mixed $offset) Example #1 Basic usage <?php class obj implements ArrayAccess { private $container = array(); public function __construct() { $this->container = array( "one" => 1, "two" => 2, "three" => 3, ); } public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } public function offsetExists($offset) { return isset($this->container[$offset]); } public function offsetUnset($offset) { unset($this->container[$offset]); } public function offsetGet($offset) { return isset($this->container[$offset]) ? $this->container[$offset] : null; } } $obj = new obj; var_dump(isset($obj["two"])); var_dump($obj["two"]); unset($obj["two"]); var_dump(isset($obj["two"])); $obj["two"] = "A value"; var_dump($obj["two"]); $obj[] = 'Append 1'; $obj[] = 'Append 2'; $obj[] = 'Append 3'; print_r($obj); ?> The above example will output something similar to: bool(true) int(2) bool(false) string(7) "A value" obj Object ( [container:obj:private] => Array ( [one] => 1 [three] => 3 [two] => A value [0] => Append 1 [1] => Append 2 [2] => Append 3 ) ) PHP Documentation Group ARRAYACCESS(3)
Man Page