PHP var_export() Function
var_export() The function is used to output or return a variable, represented as a string.
var_export() The function returns structural information about the variable passed to it; it is similar to var_dump() , except that it returns a valid PHP code string.
PHP version requirement: PHP 4 >= 4.2.0, PHP 5, PHP 7
Syntax
mixed var_export ( mixed $expression [, bool $return ] )
Parameter Description:
- $expression: the variable you want to output.
- $return: optional; if set to TRUE, the function will not output the result but return it to a variable.
Return Value
A return value is produced only when $return is set to true, returning the structural information of the variable.
Example
Example
The output is:
array (
0 => 1,
1 => 2,
2 =>
array (
0 => 'a',
1 => 'b',
2 => 'c',
),
)
Optional parameter $return set to true:
Example
The output is:
3.1
Available PHP Functions