The var_export() function is used to output or return a variable, expressed in string form.
The var_export() function returns structural information about the variables passed to the function. It is similar to var_dump(), except that it returns a legal PHP code.
PHP version requirements: PHP 4 >= 4.2.0, PHP 5, PHP 7
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 perform output results, but will return the output results to a variable.
The return value is only available when $return
is set to true, and the structure information of the variable is returned.
The output is:
array ( 0 => 1, 1 => 2, 2 => array ( 0 => 'a', 1 => 'b', 2 => 'c', ),)
The optional parameter $return
is set to true:
The output is:
3.1