rounding - Round Off in PHP -
i want round off number exact value of decimal in php.
eg:
1.399 => 1.39 or 363.3 => 363.30
i have used printf("%.2f", 1.399)
, number_format((float)$a,2,'.','')
answer 1.40
incorrect me.
you can use floor()
round down:
$number = 1.399; $roundednumber = number_format(floor($number * 100)/100, 2); echo $roundednumber; //returns 1.39
Comments
Post a Comment