On Fri, Jul 19, 2013 at 8:55 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:

> Hi Sara,
>
> 2013/7/20 Sara Golemon <poll...@php.net>
>
> > I would ask that you don't "fix" the docs, as we want to continue to
> > discourage users from engaging in unsafe behaviors.
>
>
> If precedence is implemented correctly, there should not be any ambiguity.
> If precedence is not implemented correctly, I suppose it is a bug as ++/--
> have
> much higher precedence.
>

I don't understand how it's a bug. Precedence is implemented correctly and
works as I'd expect it to. Here's the proof

http://3v4l.org/mR4da/vld#tabs

If you run this code through VLD you see that the opcodes clearly execute
both increment operators before the addition operator. This seems to hold
true from PHP 4.3.0 to 5.5.1 according to 3v4l.org. After all they do have
higher precedence in the precedence table.

$a = 1;
++$a // $a is now 2
$a++ // $a is still 2 and returns its value then increments to 3 (it's a
POST increment)
2 + 2 // The result is clearly 4

I would say that the behavior of these operators and their precedence is
very much well-defined. I don't see what the confusion.


>
> We don't want such docs nor bugs, don't we?
> Anyone know if the doc is correct or not?
> Thanks in advance.
>
>
I don't see where there is a bug in the documentation, no.


> Regards,
>
> --
> Yasuo Ohgaki
> yohg...@ohgaki.net
>

Reply via email to