Keys →
Functions ↓
function fix ( $num, $places=0, $opt=0 ) {#-k math equiv#- Because I'm fed up with trying to remember it's not fixed or float, and this is shorter and req's only 1 arg#-p $f - req - number to fix#-p $places - opt - 0 (default) means INT, else number decimal places.#-p $opt - opt - 0 (default) treat as a regulat float or int#-p - 1 trunc, not round (1.09 => 1.00)#-p - 2 floor, not round (-1.3 => -2 not -1)#-d 2/19/21 - Added#-r Supercedes: trunc#-s See also: rem is_uge is_ugt umax switch ($opt) {case 0: # round return round ( $num, $places );case 1: # trunc $i = round($num,$places); $f = $num-$i; if (($num > 0) && ($f < 0)) $i=$i-1*pow(10,-$places); if (($num < 0) && ($f > 0)) $i=$i+1*pow(10,-$places); return $i;case 2: # floor return floor ( $num ); } }?>