Snippets

Create an account or login to be able to add, comment and rate snippets.

Navigation

Dump variables/objects to screen

Sometimes a set of circumstances will arise when the programmer is not certain what objects are available to a particular point of a symfony app (the manual is, at the time of writing, not entirely exhaustive).

Simply pop this code in your code temporarily and the output should give you some clues.

$vars = get_defined_vars();
foreach($vars as $key => $val) {
  $t = gettype($$key);
  echo "${key} (${t})<br />";
}
by halfer on 2006-06-02, tagged debug  objects  variables 

Comments on this snippet

gravatar icon
#1 Arthur Koziel on 2006-06-16 at 09:02

Just used this little snipped, it was very usefull! Thanks

You need to create an account or log in to post a comment or rate this snippet.