English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
var_export() function is used to output or return a variable as a string.
var_export() The function returns structural information about the variable passed to the function, it is similar to var_dump() Similar, but different is that it returns a valid PHP code.
PHP version requirement: PHP 4 => 4.2.0, PHP 5, PHP 7
mixed var_export ( mixed $expression [, bool $return ] )
Parameter description:
When $return is set to true, a return value is available, returning the structural information of the variable.
<?php $a = array (1, 2, array ("a", "b", "c")); var_export ($a); ?>
The output result is:
array ( 0 => 1, 1 => 2, 2 => array ( 0 => 'a', 1 => 'b', 2 => 'c', ), )
Optional parameter $return set to true:
<?php $b = 3.1; $v = var_export($b, TRUE); echo $v; ?>
The output result is:
3.1