How rounding a number in a big way with a given accuracy?

A bunch of years, I use PHP and just now noticed that the direction of rounding is determined only for 5ки at the end of (10.15).
echo round(10.14, 1); // 10.1
echo round(10.14, 1, PHP_ROUND_HALF_UP); // 10.1
echo round(10.14, 1, PHP_ROUND_HALF_DOWN); // 10.1
echo round(10.14, 1, PHP_ROUND_HALF_EVEN); // 10.1
echo round(10.14, 1, PHP_ROUND_HALF_ODD); // 10.1


But what do I do with the number of 10.14? I want to round it to 10.2.
March 23rd 20 at 19:03
1 answer
March 23rd 20 at 19:05
Solution
echo floor(10.14 * 10) / 10; // 10.1
echo ceil(10.14 * 10) / 10; // 10.2

Find more questions by tags PHP