round decimals to a specific value with php
Get the solution ↓↓↓I am trying to make a float number e.g. 110.34 to "round" to 110.90 The thing is I am converting product prices caused by currency switcher and I want to make the values values look good.
I have somewhere the function
function($price)
which gives me the price of the product.
And I was trying to make it with the round() function e.g.
return round($price * 2, 0) / 2;
But this will round it to x.00 or x.50
Is there any other function that can round all values to x.90?
Answer
Solution:
Now i made it like this?
return intval($price) + 0.90;
is this the right way, at least it looks good. :-D
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: sqlstate[hy000] [1698] access denied for user 'root'@'localhost'
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.