if($noHouse)
{
$totalMoney = $houseMoney + $basicMoney;
}
if($sex == "男")
{
$totalMoney = $totalMoney + 0;
}
else if($isPregnancy)
{
$totalMoney = $totalMoney + $pregnancyMoney;
$totalMoney = $totalMoney + 300;
}else{
$totalMoney = $totalMoney + 300;
}
{
$totalMoney = $houseMoney + $basicMoney;
}
if($sex == "男")
{
$totalMoney = $totalMoney + 0;
}
else if($isPregnancy)
{
$totalMoney = $totalMoney + $pregnancyMoney;
$totalMoney = $totalMoney + 300;
}else{
$totalMoney = $totalMoney + 300;
}
2017-07-25
<?php
$sum = 12;//小宠物当前的饥饿程度
echo "我饿啦:-(";echo "饥饿度".$sum;
echo "<br />";
while($sum<100){//小宠物的饥饿程度到100,表示小宠物吃饱啦,不用继续喂了,没吃饱继续喂食
$num = rand(1,20);//随机数,模拟喂食小宠物
$sum = $sum + $num; //小宠物吃小面包
echo "我还没吃饱呢!"; echo"+".$num." 饥饿度".$sum;
echo "<br />";
}
echo "终于吃饱啦^_^";echo "饥饿度".$sum;
?>
$sum = 12;//小宠物当前的饥饿程度
echo "我饿啦:-(";echo "饥饿度".$sum;
echo "<br />";
while($sum<100){//小宠物的饥饿程度到100,表示小宠物吃饱啦,不用继续喂了,没吃饱继续喂食
$num = rand(1,20);//随机数,模拟喂食小宠物
$sum = $sum + $num; //小宠物吃小面包
echo "我还没吃饱呢!"; echo"+".$num." 饥饿度".$sum;
echo "<br />";
}
echo "终于吃饱啦^_^";echo "饥饿度".$sum;
?>
2017-07-25
<?php
$sum = rand(1,100);
echo "我饿了";
echo"<br />";
while ($sum <100)
{
$num = 10;
$sum = $sum + $num;
echo "$sum"."<br />"."我还没吃饱呢";
echo "<br />";
}
echo "我吃饱啦";
?>
$sum = rand(1,100);
echo "我饿了";
echo"<br />";
while ($sum <100)
{
$num = 10;
$sum = $sum + $num;
echo "$sum"."<br />"."我还没吃饱呢";
echo "<br />";
}
echo "我吃饱啦";
?>
2017-07-25
发现一个有趣的现象,当你用连接符(.)连接不同的字符串时,这两个字符串需要同样使用双引号或单引号,一个双一个单这里居然就报错了。
2017-07-25
<?php
date_default_timezone_set('Asia/ShangHai');
$today = date('m-d',time());
$birthday = "07-24";
$money = 238;
$discount = 0.8;
if ($today == $birthday)
{
$money =$money * $discount;
}
else
{
$money =$money * 1;
}
echo $money;
?>
date_default_timezone_set('Asia/ShangHai');
$today = date('m-d',time());
$birthday = "07-24";
$money = 238;
$discount = 0.8;
if ($today == $birthday)
{
$money =$money * $discount;
}
else
{
$money =$money * 1;
}
echo $money;
?>
2017-07-24