Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Jeo Paloma
Jeo Paloma
2,472 Points

Could someone explain var_dump to me in a simple way please thank you

I'm a newbie and var_dump is a bit confusing to me

1 Answer

Simon Coates
Simon Coates
28,693 Points

it displays value and data type for what is contained in a variable. see http://php.net/manual/en/function.var-dump.php for the official explanation and examples. The examples are pretty helpful and cover a few different variable types.

I don't think it's something you'd use in a real live website. It's just something you use when you want to see what value you have (in a debugging context). To output a value normally, you'd use echo or print. However, sometimes you just want a quick look at a variable when you're putting a page together, or want more precise information. (some different values may produce the same output using echo, making it unclear as to the precise contents of a variable).