I'm very new to php. I'm reading a book having an example about while loop:
<html>
<body>
<table border="0" cellpadding="3">
<tr>
<td bgcolor="#CCCCCC" align="center">Distance</td>
<td bgcolor="#CCCCCC" align="center">Cost</td>
</tr>
<?
$distance = 50;
while ($distance <= 250) {
echo "<tr>
<td align=\"right\">".$distance."</td>
<td align=\"right\">".($distance / 10)."</td>
</tr>\n";
$distance += 50;
}
?>
</table>
</body>
</html>
Here's the result when I run this code on Apache web server:
\n"; $distance += 50; } ?>
Distance Cost
".$distance." ".($distance / 10)."
I don't know why the value of $distance
is not printed. Could you help me fix it? Thank you very much!