How do I remove some numbers after the comma in PHP? ex: 25.52382832732732 ... so I want it to stay only 25.52
How do I remove some numbers after the comma in PHP? ex: 25.52382832732732 ... so I want it to stay only 25.52
This would be a solution
You use the round
function that in the first parameter receives the number and in the second it receives the optional number of decimal digits to round with the default being 0
$valor = round(25.52382832732732, 2);
echo $valor;
One of the ways to do this is with number_format
, from this momentum:
number_format($valor, 2);