[Solved] Rounding decimal number only last two digit PHP


$input=0.27777777777778;
$number = number_format(round($input,1),2);
echo $number;

Round your number to 0.3, then use number format to show two decimal points.

From the PHP manual / docs:

  • Rounding numbers – Link
  • Number format – Link

1

solved Rounding decimal number only last two digit PHP