how to use var_dump and print_r in magento

Posted by Damodar Bashyal on April 24, 2009

 

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());

These are methods available for a product:

More»

QR Code: how to use var_dump and print_r in magento