PHP - What does "Operator precedence and associativity do not specify an order of evaluation" mean?
I am reading the Operator Precedence section of the PHP Manual. I am confused about (or say, I don't understand the following sentences quite much):
Operator precedence and associativity only determine how expressions are grouped, they do not specify an order of evaluation. PHP does not (in the general case) specify in which order an expression is evaluated and code that assumes a specific order of evaluation should be avoided, because the behavior can change between versions of PHP or depending on the surrounding code.
It also gives two examples to illustrate the undefined order of evaluation.
$a = 1;
echo $a + $a++; // may print either 2 or 3
From what I understand, $a evaluats to 1 first because the associativity of the addition operator is left. Then 1 is added to $a++, which evaluates to 1. So, then result should be 2. Why does the comment in the documentation say "may print either 2 or 3"?
The second example is:
$i = 1;
$array[$i] = $i++; // may set either index 1 or 2
Similarly, $i++ evaluates to 1 first because the associativity of the assignment operator is right. Then the value of 1 should be set to the index 2 of the array. Why does the comment say "may set either index 1 or 2"?
The only explanation I can think of is that the order of code in the two examples above can be executed the opposite of what I reasoned.
Any thoughts to help me unravel my confusion will be greatly appreciated.