Current Location: Home> Function Categories> var_export

var_export

Output or return a string representation of a variable
Name:var_export
Category:Variable processing
Programming Language:php
One-line Description:Returns structured information about the variable (valid PHP code).

Definition and usage

var_export() function outputs or returns structured information about the variable.

The function works similarly to var_dump() , except that the return value of the function is valid PHP code.

Example

Output structured information about variables:

 <?php
$a = 32 ;
echo var_export ( $a ) . "<br>" ;

$b = "Hello world!" ;
echo var_export ( $b ) . "<br>" ;

$c = 32.5 ;
echo var_export ( $c ) . "<br>" ;

$d = array ( "red" , "green" , "blue" ) ;
echo var_export ( $d ) . "<br>" ;

$e = array ( 32 , "Hello world!" , 32.5 , array ( "red" , "green" , "blue" ) ) ;
echo var_export ( $e ) . "<br>" ;
?>

Try it yourself

grammar

 var_export ( variable , return ) ;
parameter describe
variable Required. Specifies the variable to check.
Return Optional. If set to true, it returns the representation of the variable, rather than outputting it.
Similar Functions
Popular Articles