您好,登錄后才能下訂單哦!
php趣味編程-php求個人所得稅
<?php header("Content-Type: text/html; charset=utf-8"); /* 個人所得稅 以3500后的數字 1 500 5 0 2 500-2000 10 25=500*0.5 3 2000-5000 15 25+150 = 175 4 5000-20000 20 25+150+450 = 625 5 20000-40000 25 25+150+450+15000*0.2=625+3000=3625 6 40000-60000 30 3625 + (40000-20000)*0.25 =3625 +5000=8625 7 60000-80000 35 8625+6000 = 14625 8 80000-100000 40 14625 + 2*0.35 = 21625 9 100000-..... 45 21625 + 2*0.4 = 29625 4000 - 3500 = 500*0.05=25 4100 -3500 = 610 = 500*0.05+110*0.10=25+11 8000 -3500 = 4500 = 500*0.05 + (2000-500)*0.1 + 2500*0.15 */ ?> <?php $money = 1108800; //個人的月收入 $jibie = $money - 3500;//交稅的錢 if($jibie <= 500) { $a = $jibie * 0.05;//所得稅-就是每個月交的稅 } else if($jibie <= 2000){ $a = 25 +($jibie - 500)*0.1; } else if($jibie <= 5000){ $a = 175 + ($jibie - 2000)*0.15; } else if($jibie <=20000){ $a = 625 + ($jibie - 5000)*0.2; } else if($jibie <= 40000){ $a = 3625+($jibie - 20000)*0.25; } else if($jibie <=60000){ $a = 8625 + ($jibie - 40000)*0.3; } else if($jibie <=80000){ $a = 14625 + ($jibie - 60000)*0.35; } else if($jibie <=100000){ $a = 21625 +($jibie - 80000)*0.4; } else{ $a = 29625+($jibie - 100000)*0.45; } //echo $a; ?> <?php /* 累積的不要手動算 */ $salary = array(0,500,2000,5000,20000,40000,60000,80000,100000);//用來存個人所得的錢 $rate =array(5,10,15,20,25,30,35,40,45);//稅息 $moneys = 5000;//假設月收入 $b = $moneys - 3500; $index = 0; $sum = 0; for($i=0;$i<sizeof($salary);$i++){ if($b <$salary[$i]){ $index = $i; break; } } //循環得到扣除累計算 for($i=0;$i<$index;$i++) { $sum = $sum+( $salary[$i+1] - $salary[$i] )*$rate[$i]*0.01; } $a = $sum + ($moneys-$salary[$index-1])*$rate[$index-1]*0.01; echo '月收入:'.$moneys.'交稅是:'.$a; ?>
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。