【php开源代码栏目提醒】:网学会员php开源代码为您提供birth.php参考,解决您在birth.php学习中工作中的难题,参考学习。
<?php
$birth_month=1;
$birth_day=29;
$birth_year=1995;
if (empty($birth_month) || empty($birth_day) || empty($birth_year) )
{
die("生日不完整!");
}
switch($birth_month)
{
case 1: print "January "; break;
case 2: print "February "; break;
case 3: print "March ";break;
case 4: print "April ";break;
case 5: print "May "; break;
case 6: print "June "; break;
case 7: print "July "; break;
case 8: print "August "; break;
case 9: print "September "; break;
case 10: print "October "; break;
case 11: print "November "; break;
case 12: print "December "; break;
default: die("月份不合法!");
}
if (($birth_day < 1) || ($birth_day > 31))
{
die("日期不对!!");
}
else
{
echo $birth_day, " ";
}
if (($birth_year < 1900) || ($birth_year >2005))
{
die("年份不对!");
}
else
{
echo $birth_year;
}
?>