math - round number to nearest 0.2 with PHP -
I am using this rating system 5-edged stars And I want a title to include the average rating, so I have shown the stars 1/5th. Using "1.2" I will get a full star and a point on the next star ...
But I have not found a good way to score the nearest distance. 2. I thought I I can multiply by 10, then I make a goal, and then a switch goes from 1 to 2, 3 to 4 and the other goes on. But it seems tedious and unnecessary ...
round (3.78 * 5) / 5 = 3.8 < / Div>
Comments
Post a Comment