PHP var_dump function


 

PHP var_dump function

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 - 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;

0

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

?>

1

Output:

int(12)

 bool(true)

2

float(12.121)

 

 

3

 

 

 

4

 

 

Ads