hi,
the 0 evals to false and stops your for loop, not reset... try the following
loop line instead:
while (list($key,$dummy)=each($groupid)) {
b.
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 10, 2001 2:05 AM
Subject: [PHP-DEV] PHP 4.0 Bug #8622: Using "0" as a key in accociative
arrays crashes reset() , next(), etc.
> From: [EMAIL PROTECTED]
> Operating system: Linux (also NT)
> PHP version: 4.0.4
> PHP Bug Type: Scripting Engine problem
> Bug description: Using "0" as a key in accociative arrays crashes reset()
, next(), etc.
>
> <?
> print "Using \"0\" as a key in accociative arrays<br>\n"
> ."crashes reset() , next(), etc.<br><br>\n\n";
>
> $groupid["SHOOT"] = "DARNIT";
> $groupid["DER"] = "DARNIT";
> $groupid["FSD"] = "DARNIT";
> $groupid["SDF"] = "DARNIT";
> $groupid["DSF"] = "DARNIT";
> $groupid["0"] = "DARNIT";
> $groupid["DSF2"] = "DARNIT";
>
> print "REGULAR VARIABLE REFERENCING WORKS:<br>\n";
> print "\$groupid[\"SHOOT\"] = ".$groupid["SHOOT"]."<br>\n";
> print "\$groupid[\"DER\"] = ".$groupid["DER"]."<br>\n";
> print "\$groupid[\"FSD\"] = ".$groupid["FSD"]."<br>\n";
> print "\$groupid[\"0\"] = ".$groupid["0"]."<br>\n";
> print "\$groupid[\"SDF\"] = ".$groupid["SDF"]."<br>\n";
> print "\$groupid[\"DSF\"] = ".$groupid["DSF"]."<br>\n";
> print "\$groupid[\"DSF2\"] = "
> .$groupid["DSF2"]."<br><br>\n";
>
> print "arraycount = ".count($groupid)."<BR>\n";
> print "Using 'for (reset(\$groupid); \$key = key(\$groupid);
next(\$groupid))'<BR>\n";
> for (reset($groupid); $key = key($groupid); next($groupid)) {
> print "\$groupid[\"$key\"] = $groupid[$key]<br>\n";
> }
> print "<br>\nThe arraycount still works and so does<br>\n"
> ."referencing the variable, however, the reset()<br>\n"
> ."next(), and associated functions crash.<br>\n";
> ?>
>
>
> --
> Edit Bug report at: http://bugs.php.net/?id=8622&edit=1
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]