fix to 2 decimal places php
snippet in php

php float 2 decimais

user4316

$foo = "105";
echo number_format((float)$foo, 2, '.', '');

fix to 2 decimal places php

user7151

return number_format((float)$number, 2, '.', '');

2 decimal round using php

user4041

// using round() function we can roundoff float values in php
$value = 58.24365;
round($value, 2);
//result 58.24

round to 2 decimal places php

user4077

round(520.34345, 2);   // 520.34