<?php
$sum = 12;//小宠物当前的饥饿程度
echo "我饿啦:-(";
echo "<br />";
while($sum<100){//小宠物的饥饿程度到100,表示小宠物吃饱啦,不用继续喂了,没吃饱继续喂食
$num = rand(1,20);//随机数,模拟喂食小宠物的小面包
$num2=rand(1,15);
$sum = $sum + $num-$num2;
echo "我还没吃饱呢!";
echo "<br />";
echo "HP:".$sum;
}
echo "终于吃饱啦^_^";
?>
$sum = 12;//小宠物当前的饥饿程度
echo "我饿啦:-(";
echo "<br />";
while($sum<100){//小宠物的饥饿程度到100,表示小宠物吃饱啦,不用继续喂了,没吃饱继续喂食
$num = rand(1,20);//随机数,模拟喂食小宠物的小面包
$num2=rand(1,15);
$sum = $sum + $num-$num2;
echo "我还没吃饱呢!";
echo "<br />";
echo "HP:".$sum;
}
echo "终于吃饱啦^_^";
?>
2018-05-10
<?php
$str_string1 = '甲问:"老师教的怎么样"';
$str_string2 = "乙毫不犹豫地回答:'当然好咯!'";
$str_string3 = '甲问:\'能具体说说么?\'';
$str_string4 ="乙答道:'\"毫不犹豫\"一词用的好,好就好在这波广告打得我猝不及防'";
echo $str_string1;
echo "<br />";
echo $str_string2;
echo "<br />";
echo $str_string3;
echo "<br />";
echo $str_string4;
echo "<br />";
?>
$str_string1 = '甲问:"老师教的怎么样"';
$str_string2 = "乙毫不犹豫地回答:'当然好咯!'";
$str_string3 = '甲问:\'能具体说说么?\'';
$str_string4 ="乙答道:'\"毫不犹豫\"一词用的好,好就好在这波广告打得我猝不及防'";
echo $str_string1;
echo "<br />";
echo $str_string2;
echo "<br />";
echo $str_string3;
echo "<br />";
echo $str_string4;
echo "<br />";
?>
2018-05-09
<?php
date_default_timezone_set('Asia/ShangHai');
$today = date('m-d',time());//获取当天日期
$birthday = "05-07";//生日
$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 = "05-07";//生日
$money = 238;//消费金额
$discount = 0.8;//八折优惠
if($today==$birthday)
{
$money=$money*$discount;
}else{$money=$money*1;}
echo $money;
?>
2018-05-07