PHP var_export() Function

PHP output_add_rewrite_var() Function
PHP var_dump() Function

In this article, you will learn how to get the structured information about a variable in PHP. The var_export() function in PHP 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.

what is the syntax of the VAR_EXPORT() function in php?

var_export(variable, return);
ParametersDetails
variableRequired. Specifies the variable to check
returnOptional. If set to true, it returns the variable representation instead of outputting it
PHP VAR_EXPORT() method

examples of the VAR_EXPORT() function

Example 1. In this example, we 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>";
?>
PHP output_add_rewrite_var() Function
PHP var_dump() Function

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top