Requesting that will at least require a major-release (f.e. PHP 6.0) ... but I
would rather request to add a notice or warning to the documentation of
references to remind stuff like that.
http://www.php.net/manual/en/language.references.php
I think this is stuff more people will stumble over
Note that somewhat similar error was discussed on this list a few months
ago[1]. You could probably have solved it yourself if you searched the mailing
list archives.
- Matijn
[1] http://www.mail-archive.com/php-general@lists.php.net/msg269552.html
---
Thanks Matijn, I missed that discussion,
See this following example that illustrates the problem:
$array = array(0, 1, 2, 3, 4, 5, 6);
foreach ($array as $index=$value) {
if ( ($index+1) count($array) ) {
$array[$index+1] += $value;
}
echo $value. ;
}
echo br /;
foreach ($array as
From: Simon Schick [mailto:simonsimc...@googlemail.com]
Sent: 24 March 2012 12:30 AM
To: Robert Cummings
Cc: a...@dotcontent.net; php-general@lists.php.net
Subject: Re: [PHP] foreach weirdness
2012/3/23 Robert Cummings rob...@interjinn.com
On 12-03-23 11:16 AM, Arno Kuhl wrote:
it still
On Sun, Mar 25, 2012 at 4:11 PM, Arno Kuhl a...@dotcontent.net wrote:
From: Simon Schick [mailto:simonsimc...@googlemail.com]
Sent: 24 March 2012 12:30 AM
To: Robert Cummings
Cc: a...@dotcontent.net; php-general@lists.php.net
Subject: Re: [PHP] foreach weirdness
2012/3/23 Robert Cummings
2012/3/25 Arno Kuhl a...@dotcontent.net:
will not only give the wrong result, it will corrupt the array for *any*
further use of that array. I still think it’s a bug according to the
definition of foreach in the php manual. Maybe php needs to do an implicit
unset at the closing brace of
On 3/23/2012 10:11 PM, Robert Cummings wrote:
On 12-03-23 06:30 PM, Simon Schick wrote:
2012/3/23 Robert Cummingsrob...@interjinn.com
On 12-03-23 11:16 AM, Arno Kuhl wrote:
it still does not produce the correct result:
0 1 3 6 10 15 21
0 1 3 6 10 15 15
This looks like a bug... the
On 12-03-24 11:15 AM, Al wrote:
On 3/23/2012 10:11 PM, Robert Cummings wrote:
On 12-03-23 06:30 PM, Simon Schick wrote:
2012/3/23 Robert Cummingsrob...@interjinn.com
On 12-03-23 11:16 AM, Arno Kuhl wrote:
it still does not produce the correct result:
0 1 3 6 10 15 21
0 1 3 6 10 15 15
On 12-03-23 11:16 AM, Arno Kuhl wrote:
The following snippet is copied from the php manual:
foreach ($arr as $key = $value) {
echo Key: $key; Value: $valuebr /\n;
}
I've always used the foreach loop that way.
But recently I started hitting some really odd problems.
See this following
-Original Message-
From: Robert Cummings [mailto:rob...@interjinn.com]
Sent: 23 March 2012 06:11 PM
To: a...@dotcontent.net
Cc: php-general@lists.php.net
Subject: Re: [PHP] foreach weirdness
On 12-03-23 11:16 AM, Arno Kuhl wrote:
The following snippet is copied from the php manual
On 12-03-23 02:04 PM, Arno Kuhl wrote:
Hi Rob
I'm using php 5.3.5. What result do you get when you run this code?
I haven't checked any bug reports, I'll google to see where I would do that.
Your code gets round the problem, but I was specifically referring to the use
of foreach with its
2012/3/23 Robert Cummings rob...@interjinn.com
On 12-03-23 11:16 AM, Arno Kuhl wrote:
it still does not produce the correct result:
0 1 3 6 10 15 21
0 1 3 6 10 15 15
This looks like a bug... the last row should be the same. What version of
PHP are you using? Have you checked the online
On 12-03-23 06:30 PM, Simon Schick wrote:
2012/3/23 Robert Cummingsrob...@interjinn.com
On 12-03-23 11:16 AM, Arno Kuhl wrote:
it still does not produce the correct result:
0 1 3 6 10 15 21
0 1 3 6 10 15 15
This looks like a bug... the last row should be the same. What version of
PHP are
13 matches
Mail list logo