Syntax

PHP Debug a Variable Syntax

In PHP, debug a variable: dumps a variable's type and value — var_dump($x);

Quick Answer

Syntax
var_dump($x);
PHPSyntax

Debug a Variable

Code example
var_dump($x);

Dumps a variable's type and value.

Learn More

How to debug a variable in PHP

  1. Open your PHP file or editor.
  2. Copy the example, then replace its sample names and values for your code.

PHP Debug a Variable Syntax

Use var_dump($x);.

Related Syntax References

Frequently asked questions

What is the PHP syntax for debug a variable?

Use this pattern: var_dump($x);

Can I copy this PHP code example?

Yes. Use Copy code and adapt the example to your program.

Is this PHP syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify