[PHP-DEV] PHP 4.0 Bug #8353: foreach modify array pointer From: lunepi <email protected>
Date: 12/21/00

From: lunepi <email protected>
Operating system:
PHP version: 4.0.4
PHP Bug Type: Arrays related
Bug description: foreach modify array pointer

try 1.:

$var[] = "1";
$var[] = "2";

foreach($var as $test)
{
echo $test;
}
reset($var);
echo current($var);

output -> 12

then try:
$var[] = "1";
$var[] = "2";

//reset($var);
foreach($var as $test)
{
echo $test;
current($var);
}
echo current($var);

output -> 121

this should be the output of the first script too?
Greetings lunepi

-- 
Edit Bug report at: http://bugs.php.net/?id=8353&edit=1

-- 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>