Reputation:
I have this question:
How can round two decimals place to next multiple to ten? Follow this example:
$number = 120.37
// I would like some functions or trick to transform this into 120.40
Is it possible in php?
Upvotes: 1
Views: 88
Reputation: 86
try this
number_format(round($number,1), 2, '.', '');
or just
round($number,1);
if you not need it with 2 decimals
Upvotes: 1
Reputation: 5445
use this number format
number_format($number, 2, '.', '');
It will give output 120.40
Upvotes: 3