利润计算(数轴)

function jiangjin($x){
	$a = array(0,10000000,20000000,40000000,60000000,100000000);//分为单位
	$b = array(0,0.1,0.075,0.05,0.03,0.015,0.01);
	for($i=0;$i0;$i++){
		$cha = $a[$i+1]-$a[$i];
		if($x<=$cha || $cha<0){
			$xx = $x;
		}else{
			$xx = $cha;
		}
		$y += round($xx*$b[$i+1]);
		$x -= $cha;
	}
	return $y;
}

你可能感兴趣的:(K),PHP)