PHP » GoLang |
login |
register |
about
|
|
var_export(PHP 4 >= 4.2.0, PHP 5, PHP 7) var_export — Outputs or returns a parsable string representation of a variable Descriptionvar_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
<?phpThe above example will output:
array (
0 => 1,
1 => 2,
2 =>
array (
0 => 'a',
1 => 'b',
2 => 'c',
),
)
<?phpThe above example will output: 3.1
Example #2 Exporting classes since PHP 5.1.0
<?phpThe above example will output: A::__set_state(array( 'var' => 5, ))
Example #3 Using __set_state() (since PHP 5.1.0)
<?phpThe 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
|
more
Most requested
more
Last requests
|