PHP 4.0 Bug #7185 Updated: $count++ bug (does not increase value in some cases)
| From: | Bug Database | Date: | Fri, 13 Oct 2000 16:25:35 +0000 |
| Subject: | PHP 4.0 Bug #7185 Updated: $count++ bug (does not increase value in some cases) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-34933@lists.php.net to get a copy of this message | ||
ID: 7185
Updated by: andi
Reported By: madey@OpenBSD.pl
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
Personally I wouldn't rely on the increment of "" being "1". I would set
$count to "0" (or even better to 0).
But as it worked this way in PHP 3 and I don't see a reason not to support it I have commited a
fix to the CVS tree.
Please grab it if you know how to use CVS (make sure you update the Zend CVS) and let us know if
there are still problems
Previous Comments:
---------------------------------------------------------------------------
[2000-10-13 11:03:27] madey@OpenBSD.pl
<html>
<body>
PHP 4.x : When I set $count to "", $count++ doesn't work properly.<br>
PHP 3.x : script works OK.<br>
<br>
Don't tell me that's OK ;) ... I'm perl programmer and I have some
habits...<br>
<br>
Simple example of $count++ bug.<br>
(it should print 7 lines in PHP 3.x, but in PHP 4.x it loops :( )<br>
<br>
<?php
$row_count = "7";
$count = "";
$line = "0";
while ($count < $row_count)
{
print "Line " . $line++ . ", count : " . $count++ .
"<br>n";
}
?>
</body>
</html>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7185