Drupal debugging tips: Print and Die
While developing Drupal sites, sometimes we may wish to see whether our function is getting called or whether we reach a point or not in the execution path. Usually the dpm() or print_r() functions comes handy in the case, but sometimes, we may not be able to see the debug messages printed due to page redirection just after our print.
PHP die() comes to your rescue there. You can print or print_r the variable you want to see and put the die() just after that. PHP will stop execution at this point and you can see your debug message on the screen
die("Debug point 1", print_r($some_vairable, True)); // If the second argument is true, then print_r will return a string // with the value of variable. default is false).