# VarDumper

> VarDumper is intended to replace the buggy PHP function var_dump and print_r.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [helpers](/docs/api/yii/helpers/index.md) › VarDumper

| class | `yii\helpers\VarDumper` |
| --- | --- |
| Extends | [`BaseVarDumper`](/docs/api/yii/helpers/basevardumper/index.md) |
| Since | 2.0 |
| Source | [`framework/helpers/VarDumper.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/helpers/VarDumper.php#L26) |

VarDumper is intended to replace the buggy PHP function var_dump and print_r.

It can correctly identify the recursively referenced objects in a complex
object structure. It also has a recursive depth control to avoid indefinite
recursive display of some peculiar variables.

VarDumper can be used as follows,

```
VarDumper::dump($var);
```

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| <span id="method-dump"></span>[`dump()`](/docs/api/yii/helpers/basevardumper/index.md#method-dump) static | Displays a variable. | [`BaseVarDumper`](/docs/api/yii/helpers/basevardumper/index.md) |
| <span id="method-dumpAsString"></span>[`dumpAsString()`](/docs/api/yii/helpers/basevardumper/index.md#method-dumpAsString) static | Dumps a variable in terms of a string. | [`BaseVarDumper`](/docs/api/yii/helpers/basevardumper/index.md) |
| <span id="method-export"></span>[`export()`](/docs/api/yii/helpers/basevardumper/index.md#method-export) static | Exports a variable as a string representation. | [`BaseVarDumper`](/docs/api/yii/helpers/basevardumper/index.md) |