Hi Sara,
2013/7/20 Sara Golemon <[email protected]>
> On Fri, Jul 19, 2013 at 7:16 PM, Yasuo Ohgaki <[email protected]> wrote:
>
>>
>>
>> If there aren't comments, I'll rewrite the example.
>>
>>
>> There were comments. I explicitly told you that that the behavior is
> defined as undefined. You CHOSE to ignore that comment. You CHOSE to
> break the documentation.
>
If there is defined precedence, arithmetic operation should follow it.
If there is exception, it should be documented.
I don't understand why/how the arithmetic operation can be
ambiguous with defined precedence. (++ and -- are higher than +)
$a = 1;
echo ++$a + $a++;
should always print 4 with current PHP precedence definition.
If it does not, it's a bug in language.
// mixing ++ and + produces undefined behavior
$a = 1;
echo ++$a + $a++; // may print 4 or 5
I don't see any reason it became undefined.
If this kind of simple precedence is broken, how programmers write
code and/or trust the language?
http://3v4l.org/mR4da/vld#tabs
This site seems support PHP 4.3.0 to PHP 5.5.0 and opcode looks
fine. Am I missing something?
If you would like to suggest use of (), it should be done differently. IMHO.
The comment only ruins PHP's reputation as language.
Regards,
--
Yasuo Ohgaki
[email protected]