PHP var dump

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : var_dump() function

Description

The var_dump() function is used to display structured information (type and value) about one or more variables.

Version

(PHP 4 and above)

Syntax

var_dump(variable1, variabl2, ....variablen)

Parameter

Name

Description

Required /
Optional

Type

variable1
variable2
---------
variablen

The variable being checked

Required

Mixed*

*Mixed : mixed indicates that a parameter may accept multiple (but not necessarily all) types.

Return value

Nothing

Pictorial presentation of PHP var_dump() function

Pictorial presentation of PHP var_dump() function

Example -1 :

  1. $var_name1=678;  

  2. $var_name2="a678";  

  3. $var_name3="678";  

  4. $var_name4="W3resource.com";  

  5. $var_name5=698.99;  

  6. $var_name6=+125689.66;            

  7. echo var_dump($var_name1)."
    ";  

  8. echo var_dump($var_name2)."
    ";  

  9. echo var_dump($var_name3)."
    ";  

  10. echo var_dump($var_name4)."
    ";  

  11. echo var_dump($var_name5)."
    ";  

  12. echo var_dump($var_name6)."
    ";  

  13. ?>          

Output :

int(678)
string(4) "a678"
string(3) "678"
string(14) "W3resource.com"
float(698.99)
float(125689.66)