++ имеет более высокий приоритет, чем оператор +
(x ++) сначала вернет значение x, а затем увеличит его на 1
$x = 2
$x++ // return 2, then increment it to 3
x +++ x ++ оценивается следующим образом
1. Get x value first which is 5
2. Then it will be incremented to 6
3. But first x value will be 5 because (x++) statement will return 5 first then increment the value
4. Then + operator is encountered
5. Next x will have 6 as value not 7 for the same reason (x++) will return the x value first and then increment it
6. So 5+6 is 11
7..At the end, x value will be 7
То же самое относится к ($x++)+($x++)
grouping operator ()
имеет left to right
ассоциативность. Первый ($x++)
выполняется первым.
$x = 5
($x++) returns 5 and then increment $x by 1. Same as before.
тогда последний ($ x ++) выполняется. Возвращает 6, а затем увеличивает $ x до 7
так же 5+6 // 11
возвращается обратно