In this article, you will learn how to get the information about one or more variables in PHP. The var_dump() function in PHP dumps information about one or more variables. The information holds type and value of the variable(s).
what is the syntax of the VAR_DUMP() function in php?
var_dump(var1, var2, ...);
Parameters | Details |
---|---|
var1, var2, … | Required. Specifies the variable(s) to dump information from |
examples of the VAR_DUMP() function
Example 1. In this example, we dump information about different variables.
<?php
$a = 32;
echo var_dump($a) . "<br>";
$b = "Hello world!";
echo var_dump($b) . "<br>";
$c = 32.5;
echo var_dump($c) . "<br>";
$d = array("red", "green", "blue");
echo var_dump($d) . "<br>";
$e = array(32, "Hello world!", 32.5, array("red", "green", "blue"));
echo var_dump($e) . "<br>";
// Dump two variables
echo var_dump($a, $b) . "<br>";
?>