第一关:PHP基本框架-Hello,world
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312' />
</head>
<body>
<?php
/********** Begin *********/
echo "Hello,world!";
/********** End *********/
?>
</body>
</html>
第2关:PHP数据类型与变量 - 20个苹果与10个机器人
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312' />
</head>
<body bgcolor="#3498db">
<?php
$n_Apple=0.5;
/********** Begin *********/
$n_Apple=20;
$n_Android=10;
$str1="Android: ";
$str2="Apple: ";
/********** End *********/
echo $str1.$n_Android." ".$str2.$n_Apple;
?>
</body>
</html>
第3关:PHP的运算符
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312' />
</head>
<body>
<?php
$year=2000;
/******** Begin *********/
//补全判断条件,判断输入年份是否为闰年
if($year%4==0 && $year%100!=0 || $year%400==0){ //判断为闰年,执行if中的语句
echo $year."年是闰年";
}
else{ //判断不是闰年,执行else中的语句
echo $year."年不是闰年";
}
/********** End ********/
?>
</body>
</html>