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,
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 ...
2012/3/25 Arno Kuhl :
>
> 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 the foreach where
On Sun, Mar 25, 2012 at 4:11 PM, Arno Kuhl 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
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
>
> On 12-03-23 11:16 AM, Arno Kuhl wrote:
>>
>>
&g
> 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 "";
> foreach ($array as
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 Cummings
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 bu
On 3/23/2012 10:11 PM, Robert Cummings wrote:
On 12-03-23 06:30 PM, Simon Schick wrote:
2012/3/23 Robert Cummings
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 s
On 12-03-23 06:30 PM, Simon Schick wrote:
2012/3/23 Robert Cummings
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
2012/3/23 Robert Cummings
>
> 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 bug r
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 unexp
-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 man
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: $value\n";
}
I've always used the foreach loop that way.
But recently I started hitting some really odd problems.
See this following ex
13 matches
Mail list logo