<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>counting teacher</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style type="text/css">td {text-align: right}</style>
</head>
<body>
<h1>counting teacher</h1>
<table>
<?php
// usage example
// counting_teacher.php?start=3&step=17&end=100
# gather variables, set defaults
$end=$_GET['end'];
if(! $end) {
$end=1;
}
$start=$_GET['start'];
if(! $start) {
$start=1;
}
$step=$_GET['step'];
if(! $step) {
$step=1;
}
$count=$start;
while($count<=$end) {
if($count==$start) {
print "<tr>";
print "<td>$count</td>";
}
elseif($count==$end) {
print "<td>$count</td>";
print "</tr>\n";
}
elseif(( $count % $step) == 0) {
print "<td>$count</td>";
print "</tr>\n<tr>";
}
else {
print "<td>$count</td>";
}
$count++;
}
?>
</table>
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
style="border: 0pt"
src="/valid-xhtml10.png"
alt="Valid XHTML 1.0!" height="31" width="88" /></a>
</p>
</body>
</html>