|
var_exportOutputs or returns a parsable string representation of a variable Description
mixed var_export
( mixed
$expression
[, bool $return = false
] )var_export gets structured information about the given variable. It is similar to var_dump with one exception: the returned representation is valid PHP code. Parameters
Return Values
Returns the variable representation when the Notes
Changelog
Examples
Example #1 var_export Examples
<?php The above example will output: array ( 0 => 1, 1 => 2, 2 => array ( 0 => 'a', 1 => 'b', 2 => 'c', ), )
<?php The above example will output: 3.1
Example #2 Exporting classes since PHP 5.1.0
<?php The above example will output: A::__set_state(array( 'var' => 5, ))
Example #3 Using __set_state() (since PHP 5.1.0)
<?php The above example will output: object(A)#2 (2) { ["var1"]=> int(5) ["var2"]=> string(3) "foo" } Notes
Warning
When var_export exports objects, the leading backslash is not included in the class name of namespaced classes for maximum compatibility.
See Also
|