Re: Operator precedence is undefined?
| From: | Yasuo Ohgaki | Date: | Sat, 20 Jul 2013 02:16:24 +0000 |
| Subject: | Re: Operator precedence is undefined? | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-68235@lists.php.net to get a copy of this message | ||
Hi Sherif,
Thank you for your info!
2013/7/20 Sherif Ramadan <theanomaly.is@gmail.com>
> I don't see where there is a bug in the documentation, no.
It is in doc's example code.
------
// mixing ++ and + produces undefined behavior
$a = 1;
echo ++$a + $a++; // may print 4 or 5
------
http://www.php.net/manual/en/language.operators.precedence.php
I think ?: operator is good for an example, since it has different
associativity than C/C++.
If there aren't comments, I'll rewrite the example.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net