This one is crazy with magento because sometimes it works and sometimes it just shows blank page. Once it gave me a real hard time. Finally found solution somewhere.
//I just had to do was add
->debug()
//on the object that i wanted to print as:
$obj->debug();
//e.g. if i had
$_cart = Mage::getModel('checkout/cart');
//to use print_r or var_dump, i needed to do
print_r($_cart->debug());