It would be arbitrarily breaking an explicit reference. I know I have
code lying around that relies on multiple loops cleaning up a big
complicated multi-level array. I do ugly things with references into
that array and it would completely break if PHP magically deleted my
references whether the
It is one of these things that make perfect sense when you think about
it a little bit. Yes, it catches some people, just like strpos()
returning character position 0 on a first-char match catches some
people. There is no way to fix things like these without completely
breaking things. If we ha
On Oct 22, 2009, at 1:42 AM, Antony Dovgal wrote:
On 22.10.2009 05:37, Richard K Miller wrote:
Is this a bug in PHP?
Search the bug DB before asking such questions.
http://bugs.php.net/bug.php?id=29992
http://bugs.php.net/bug.php?id=39307
http://bugs.php.net/bug.php?id=40065
http
I don't follow. Is this really the intended behavior? It seems quite
unintuitive that the original array would be modified by *empty* loops.
Suppose I create an include file that loops through $_GET variables
with references:
foreach ($_GET as &$get) { /* empty loop */ }
Subsequent foreach(
Hi Jill,
$item is now a reference to the last element of $items.
print_r($items);
foreach ($items as $item) { }
And here, the foreach loop writes to $item for each element: thus
assiging that value to the last element of $items.
The last element of $items is 'carrot'. Why does it print appl
Is this a bug in PHP?
// Output:
Array
(
[0] => apple
[1] => banana
[2] => carrot
)
Array
(
[0] => apple
[1] => banana
[2] => carrot
)
Array
(
[0] => apple
[1] => banana
[2] => banana
)
Two bananas in the last set?! Not what I expected.
Richard
-