Magento: Get cart total items, cart subtotal programmatically

In this article we get cart quantity. When we add to cart then how many product add to cart get quantity.
And how many total price of product get grand total.  


Here get cart total items......
<?php
$cartItem = Mage::getSingleton('checkout/cart')->getItemsCount(); 
echo $cartItem;
 ?>               

Here get cart subtotal......
<?php
$subTotal = $this->helper('checkout/cart')->getQuote()->getGrandTotal();
echo $subTotal; 
?>

Labels: