Debugging tips

<?php
  // Display the structure of object or arrays in Drupal's message area.
  drupal_set_message('<pre>'. print_r($array_or_object_var, TRUE) .'</pre>');
  drupal_set_message('<pre>'. print_r($node, TRUE) .'</pre>');
 
  // get_defined_vars() returns all variables available.
  // Use this with caution, it could output a huge chunk of codes that your browser can't handle.
  //  My browser crashed when I used it in _preprocess(&$vars, $hook).
  drupal_set_message('<pre>'. print_r(get_defined_vars(), TRUE) .'</pre>');
?>