FTW
Posted: Tue Jul 07, 2009 10:56 am
Code: Select all
<?php
$a = array('a', 'b');
foreach ($a as &$g) { }
foreach ($a as $g) { }
echo("<pre>");
var_dump($a);
?>
I am still not sure whether it's a bug or a very non-cool feature.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
$a = array('a', 'b');
foreach ($a as &$g) { }
foreach ($a as $g) { }
echo("<pre>");
var_dump($a);
?>
Code: Select all
<?php
$a = array('a', 'b');
foreach ($a as &$g) { }
foreach ($a as $h) { }
echo("<pre>");
var_dump($a);
?>
Code: Select all
<?php
$a = array('a', 'b', 'c');
foreach ($a as &$g) { }
foreach ($a as $g) { }
echo("<pre>");
var_dump($a);
?>
Code: Select all
<?php
$a = array('a', 'b');
foreach ($a as &$g) { }
unset ($g);
foreach ($a as $h) { }
echo("<pre>");
var_dump($a);
?>