0
在文檔http://www.php.net/manual/en/language.operators.precedence.php據說,++
和--
運算符具有很高的優先級。 但據我所知,++$x
和$x++
是不一樣的。此外,$x++
應該有最小的優先級,因爲一切都完成後其計算公式爲:PHP post-increment/descrement運算符優先級
$x = 1;
var_dump(1 and $x--); // and operator is one of last operators in the table, it will be executed before post decrement
所以,後遞增/遞減運算應該在這個表中的底部?
這就是爲什麼我從來沒有在任何語言編寫這樣的代碼,無論是:) –
@佐爾坦 - 陶馬希我是多麼緊湊將要進行ZCE考試,所以我需要知道這一點。在現實生活中,普通人永遠不會這樣做:) – avasin