PHP Class yii\helpers\BaseVarDumper

Do not use BaseVarDumper. Use [[VarDumper]] instead.
Since: 2.0
Author: Qiang Xue ([email protected])
ファイルを表示 Open project: yiisoft/yii2 Class Usage Examples

Public Methods

Method Description
dump ( mixed $var, integer $depth = 10, boolean $highlight = false ) Displays a variable.
dumpAsString ( mixed $var, integer $depth = 10, boolean $highlight = false ) : string Dumps a variable in terms of a string.
export ( mixed $var ) : string Exports a variable as a string representation.

Private Methods

Method Description
dumpInternal ( mixed $var, integer $level )
exportClosure ( Closure $closure ) : string Exports a [[Closure]] instance.
exportInternal ( mixed $var, integer $level )

Method Details

dump() public static method

This method achieves the similar functionality as var_dump and print_r but is more robust when handling complex objects such as Yii controllers.
public static dump ( mixed $var, integer $depth = 10, boolean $highlight = false )
$var mixed variable to be dumped
$depth integer maximum depth that the dumper should go into the variable. Defaults to 10.
$highlight boolean whether the result should be syntax-highlighted

dumpAsString() public static method

This method achieves the similar functionality as var_dump and print_r but is more robust when handling complex objects such as Yii controllers.
public static dumpAsString ( mixed $var, integer $depth = 10, boolean $highlight = false ) : string
$var mixed variable to be dumped
$depth integer maximum depth that the dumper should go into the variable. Defaults to 10.
$highlight boolean whether the result should be syntax-highlighted
return string the string representation of the variable

export() public static method

The string is a valid PHP expression that can be evaluated by PHP parser and the evaluation result will give back the variable value. This method is similar to var_export(). The main difference is that it generates more compact string representation using short array syntax. It also handles objects by using the PHP functions serialize() and unserialize(). PHP 5.4 or above is required to parse the exported value.
public static export ( mixed $var ) : string
$var mixed the variable to be exported.
return string a string representation of the variable