1

I have below number

12.81 -> 12.90
12.70 -> 12.70
12.65 -> 12.70

In short after second decimal it should be round up the decimal values.

.81 -> .89 should become .90. Else as it is.

I already tried

echo round(12.81, 2, PHP_ROUND_HALF_UP);

ceil seems not going to work here.

Jackson
  • 1,218
  • 1
  • 24
  • 53

1 Answers1

1

Try this here:

echo ceil(12.81 * 10) / 10;
Joshua Beckers
  • 797
  • 1
  • 9
  • 21