<!DOCTYPE html>
<html>
<head>
<title>Leap Year</title>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<?php
function isLeap($year) {
return ((($year % 4) == 0) && ((($year % 100) != 0)));
}
for($year=1991; $year<=2100; $year++)
{
If (isLeap($year))
{
$leap="$year : LEAP YEAR <br/>";
//echo "<div class='col-sm-12'>" . $leap . "</div>";
echo $leap;
}
else
{
$nonLeap="$year : Not leap year <br/>";
//echo "<div class='col-sm-6'>" . $nonLeap ."</div>";
echo $nonLeap;
}
}
?>
</body>
</html>
for
循环内,你可以将它们存储在两个数组中,然后使用它们构建你的表格。试一下,然后更新你的答案。 - Federkun