php-developer-list | 2000101

[PHP-DEV] PHP 4.0 Bug #7185 Updated: $count++ bug (does not increase value in some cases) From: Bug Database (php-dev <email protected>)
Date: 10/13/00

ID: 7185
Updated by: andi
Reported By: madey <email protected>
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 <email protected>
<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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>