bug in echo function?
| From: | Billy Harvey | Date: | Fri, 18 Jan 2002 18:44:08 +0000 |
| Subject: | bug in echo function? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-81129@lists.php.net to get a copy of this message | ||
I ran across a curious bug in the echo function this morning. My PHP is
Debian binary 4.1.1-1.
The first example below does not work (it should draw a
checkerboard-like table):
-----
<html>
<head>
<title>Chess</title>
<body>
<table border=1>
<?
for ($i=0 ; $i<8 ; $i++) {
echo "<tr align=center valign=center>";
for ($j=0 ; $j<8 ; $j++) {
echo "<td>" . ($i*8)+$j . "</td>";
}
echo "</tr>\n";
}
?>
</table>
</body>
</html>
-----
However, by changing the echo line to two echo lines, it works as
desired:
-----
<html>
<head>
<title>Chess</title>
<body>
<table border=1>
<?
for ($i=0 ; $i<8 ; $i++) {
echo "<tr align=center valign=center>";
for ($j=0 ; $j<8 ; $j++) {
echo "<td>";
echo ($i*8)+$j . "</td>";
}
echo "</tr>\n";
}
?>
</table>
</body>
</html>
-----
I don't see any limitations about concatenating strings in the man page
of the echo statement. Perhaps this is a bug?
Billy