DevChunks

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).

Share:

One Response

Leave a Reply

Your email address will not be published.

More Posts

How to use PHP Type Declarations

PHP has developed into a more strictly typed language in recent years. Type Declarations help with that and are a fairly new addition to PHP,

Iteration

If you have come to JavaScript from a background in Java or C, then you will like the variation on the for loop. It is

Context Object Manipulation

One of the key concepts of JavaScript is the keyword this, which signifies the JavaScript context object. If you write an inner function, you can access

Polymorphic Functions

It is possible to define multiple functions with the same name in JavaScript, and the last one of those that you define will be the