The content shared with you in this article is about [PHP's Variable handling function] var_export, which has certain reference value. Friends in need can refer to it
var_export
(PHP 4 >= 4.2.0, PHP 5, PHP 7)
var_export — Export or return a string representation of a variable
Description:
mixed var_export ( mixed $expression [, bool $return ] )
Returns structural information about the variables passed to this function, similar to var_dump(), except that the returned representation is legal PHP code.
Returns a representation of a variable by setting the second parameter of the function to TRUE.
<!-- 比较 var_export() 和 var_dump(). --><pre class="brush:php;toolbar:false"><?php$a = array (1, 2, array ("a", "b", "c")); var_export ($a);// print_r ($a);// var_dump ($a);/* 输出: array ( 0 => 1, 1 => 2, 2 => array ( 0 => 'a', 1 => 'b', 2 => 'c', ), ) */$b = 3.1;$v = var_export($b, TRUE);echo $v;/* 输出: 3.1 */?>
The above is the detailed content of [PHP's Variable handling function] var_export. For more information, please follow other related articles on the PHP Chinese website!