PHP var_export() Function
❮ PHP Variable Handling Reference
Example
Output structured information about variables:
<?php
$a = 32;
echo var_export($a) . "<br>";
$b = "Hello
world!";
echo var_export($b) . "<br>";
$c = 32.5;
echo
var_export($c) . "<br>";
$d = array("red", "green",
"blue");
echo var_export($d) . "<br>";
$e = array(32, "Hello world!", 32.5, array("red", "green", "blue"));
echo var_export($e) . "<br>";
?>
Try it Yourself »
Definition and Usage
The var_export() function outputs or returns structured information about a variable.
This function works similar to var_dump(), except that the returned value for this function is valid PHP code.
Syntax
var_export(variable, return);
Parameter Values
Parameter | Description |
---|---|
variable | Required. Specifies the variable to check |
return | Optional. If set to true, it returns the variable representation instead of outputting it |
Technical Details
Return Value: | If return is set to TRUE, it returns the variable representation. Otherwise, it returns NULL |
---|---|
Return Type: | Mixed |
PHP Version: | 4.2+ |
❮ PHP Variable Handling Reference