I’ve had a good look around for any help with my problem so hopefully someone can help me here.
Basically i have a number which is saved into a $price, the number is 15900. Which should translate to 159.00.
Does anyone know how to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use
number_formatfor this. It will return a string, thereby keeping the decimal places intact, even if they will be.00.Or better still, maybe have a look at
money_formatas well, depending on whether internationalized notations and/or currency symbols are of importance as well.