How to get the logged in user details on phtml page – Magento

<?php
 $customer = Mage::getSingleton('customer/session')->getCustomer();
 $email = $customer->getEmail();// for email address
 $firstname = $customer->getFirstname();//  For first name
 $lastnam e= $customer->getLastname();// For last name
?>