Statement on glibc/iconv Vulnerability

Voting

: four plus two?
(Example: nine)

The Note You're Voting On

itbudaoweng at gmail dot com
5 years ago
If you want to ceil decimal, DO NOT USE

function floordec($zahl,$decimals=2){
return floor($zahl*pow(10,$decimals))/pow(10,$decimals);
}

if you call it floordec(0.58, 2) it return 0.57.

[USE below instead,both work fun]

/**
*
* @param $money_yuan
* @param int $scale
* @return string
*/
static function floor($money_yuan, $scale=2) {
return bcsub($money_yuan, "-", 0, $scale);
}

/**
* @param $money_yuan
* @param int $scale
* @return string
*/
static function floor2($money_yuan, $scale = 2) {
return substr(sprintf("%.".(++$scale)."f", $money_yuan), 0, -1);
}

<< Back to user notes page

To Top