Home Tutorial Php Examples PHP var_dump function

 
 

Share on Google+Share on Google+
PHP var_dump function
Posted on: October 12, 2009 at 12:00 AM
Advertisement
PHP var_dump function - In this tutorial gives you an overview of var_dump(), its general format, & two examples. With the help of examples you can understand the functionality of var_dump() Function using PHP.

PHP var_dump Function

The PHP var_dump() function displays information about one or more than one expressions in structured way that includes its type and  value.

General format of var_dump() in PHP is:

void var_dump(mixed  $exp [, mixed $exp [,mixed $exp[,..]]])

where mixed means  a parameter may accept multiple (almost ) types.

and $exp the variable you want to export

 

PHP Var_dump Function Example 1:

<?php

$a=array(1,2,'c',true,array("a","b","c",array(3.5,5.5)));

var_dump($a);

?>

Output:

array(5) {

[0]=> int(1) [1]=> int(2) [2]=> string(1) "c" [3]=> bool(true) [4]=> array(4) {

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

 [0]=> float(3.5) [1]=> float(5.5) }

 }

 }

 

Example 2:

<?php

$a=12;

$b=true;

$c=12.121;

var_dump($a,$b,$c);

?>

Output:

int(12)

 bool(true)

float(12.121)

 

 

 

 

 

 

 

Advertisement

Related Tags for PHP var_dump function:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 12, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com