PHP » PYTHON |
login |
register |
about
|
|
var_export(PHP 4 >= 4.2.0, PHP 5) 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 ValuesReturns the variable representation when the return parameter is used and evaluates to TRUE. Otherwise, this function will return NULL. 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
See Also
|
more
Recently updated
more
Most requested
|