Well, to some degree it depends on where things are going south. That's the first thing I try to isolate, and then I'll use echo/print_r() as necessary.
NB: You guys know that you can pass true as a second argument to print_r() and it'll return the output instead of printing it? E.g.:
echo "".print_r($var, true)."
";