1<?php
2function cutAfterDot($number, $afterDot = 2){
3$a = $number * pow(10, $afterDot);
4$b = floor($a);
5$c = pow(10, $afterDot);
6echo "a $a, b $b, c $c<br/>";
7return $b/$c ;
8}
9echo cutAfterDot(2.05,2);
10
11/*
12output = a 205, b 204, c 100
132.04
14*/
15
16?>
1function cutNum($num, $precision = 2) {
2 return floor($num) . substr(str_replace(floor($num), '', $num), 0, $precision + 1);
3}