Is there a PHP function that will make the number always have 2 decimals places, even if it’s 0?
Share
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.
No, but you can format a number to a string with decimals
number_format— Format a number with grouped thousandsExample:
EDIT: the
printf/sprintfsolutions suggested deserve some upvotes too