Dump your PHP Variables with var_dump()

by Carey on December 6, 2010

Post image for Dump your PHP Variables with var_dump()

To find out the full details of any given variable in php, simply use var_dump() as follows:

{code type=php}
var_dump($variable);
{/code}

This will show you the php variable type, its value and if it is an object or array the structure and all information will be explored recursively.

The only slight disadvantage to using var_dump() is that the output is sent directly to the browser, with no parameter to control this. If you wish to email the details for example, you will have to use the php output control functions (output buffering).

{ 1 comment… read it below or add one }

Craig Vincent August 15, 2008 at 10:08 pm

I often make use of dBug, to get slightly better (or at least better presented) debug info out of PHP, take a look at http://dbug.ospinto.com/ if you’ve not seen it before :o)

Reply

Leave a Comment

Previous post:

Next post: