you can use number format
number_format($number, 2, '.', '');
May 11, 2023
6
Level 1
How to get same value after two decimal point in PHP
my Output is
3.289
i want two decimal point but out will be same like
3.28
it's shoude not to incesss if last digit more then 5 using PHP
Level 3
@parthmodi number_format(floor($number*100)/100, 2);
$number*100 will make it 328.9
then floor it to remove the remaining decimal.
then divide it to 100 to make it decimal again like 3.28
number_format() is optional. its to make sure we are getting 2 decimal
Please or to participate in this conversation.