I want to make commercial round to prices (with PHP)
For example :
15.55 becomes 15.60
15.54 becomes 15.50
147.77 becomes 147.80
==> Always zero in the end.
How can I do that ?
Thanks a lot.
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 the precision parameter of php’s round function.
See:
http://php.net/manual/en/function.round.php
http://php.net/manual/en/function.number-format.php