难道你们没发现这道题是有问题的吗?还是我自己理解错误了?求大神们解答
<?php $totalMoney = 0;//总工资 $basicMoney = 300;//基本工资 $sex = "男"; $hasHouse = TRUE; //是否有房 $houseMoney = 150;//住房补贴 $isPregnancy = TRUE; //是否怀孕 $pregnancyMoney = 100;//怀孕补贴 if($sex == "男") { $totalMoney = $basicMoney + 0;// 男的没奖金 if($hasHouse) { $totalMoney = $totalMoney + $houseMoney; } } else if($sex == "女") { $totalMoney = $basicMoney + 300;// 女的有奖金300元 if($isPregnancy) { $totalMoney = $totalMoney + $pregnancyMoney; } } echo $totalMoney; ?>
本来就不是很理解这个$noHouse
了,我把它改为$hasHouse = TRUE,发现工资还是450,你说是不是bug,不应该是300吗?
还有那个怀孕的$isPregnancy
也是一样,改为$noPregnancy = TRUE为什么还是能领那100元,谁能为我解答一下,实在不明白???