Question
$number = 153.78999
$rounded_value = round($number,2);
$rounded_value will be 153.79
What i want is if
$number = 153
then
$rounded_value = 153.00
Thanks.
You can try like this:
sprintf("%0.2f",$number);
Check sprintf
or try like this:
$rounded_value = number_format($number,2);
Check number_format
You just want the number format function $rounded_value = number_format($number,2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With