<?= round(number_format($vehicle->prices['total_rental'], 2, '.', ',') * 0.50,2) ?>
I would like the output to round up to the next 2 decimal places (for money / dollars & cents).
This works great when $vehicle->prices
is below $1,000
. When $vehicle->prices
is above $1,000
, it just outputs .50
. What is the correct way to round to next hundredth (i.e $1,452.62)
?
I have been trying round and number_format
. I cannot seem to get either one to produce the correct output when a comma becomes involved.
First do an equation, than round and as the last one thing use
number_format
.