php round and number_format code example
Example 1: php round decimal
$value = 1.23456789;
$rounded_value = round($value, 2);
// 2 is the precision here we will get 1.23
Example 2: php number format without rounding
function cutNum($num, $precision = 2) {
return floor($num) . substr(str_replace(floor($num), '', $num), 0, $precision + 1);
}