In a PHP system I'm developing, I need to update a column of the price table. The price field is in float
format and the administrator informs the percentage of increase.
Example: Reports that it will have a 10% increase.
$valor_antigo = 4,25;
$novo_valor = round(($valor_antigo + ($valor_antigo / $percentual)),2);
So, the value after the increase will be 4.68. Setting to leave only two houses after the comma.
What I need now is to round these amounts down by five cents. If I use ceil
or 'floor, I will have this rounding by only 1 in 1.
For example, the value of 4.68 above needs to be saved as 4.70. ' If the value were 5.22; would be 5,20. 7.46, would be 7.45.
How can I do this?