Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP var_export() Function

PHP var_export() Function

PHP Available FunctionsAvailable PHP Functions

var_export() The function is used to output or return a variable, represented as a string.

var_export() The function returns structural information about the variable passed to it; it is similar to var_dump() , except that it returns a valid PHP code string.

PHP version requirement: PHP 4 >= 4.2.0, PHP 5, PHP 7

Syntax


mixed var_export ( mixed $expression [, bool $return ] )

Parameter Description:

Return Value

A return value is produced only when $return is set to true, returning the structural information of the variable.

Example

Example

The output is:


array (
  0 => 1,
  1 => 2,
  2 => 
  array (
    0 => 'a',
    1 => 'b',
    2 => 'c',
  ),
)

Optional parameter $return set to true:

Example

The output is:


3.1

PHP Available FunctionsAvailable PHP Functions