【发布时间】:2013-06-18 16:04:15
【问题描述】:
在文档http://www.php.net/manual/en/language.operators.precedence.php 中说,++ 和-- 运算符具有非常高的优先级。
但据我所知,++$x 和 $x++ 并不相同。此外,$x++ 应该有最小的优先级,因为它是在一切完成后计算的:
$x = 1;
var_dump(1 and $x--); // and operator is one of last operators in the table, it will be executed before post decrement
那么,后自增/自减运算符应该在这张表的底部?
【问题讨论】:
-
这就是为什么我从来没有用任何语言写过这样的代码,不管它多么紧凑:)
-
@zoltan-tamasi 我要去参加 ZCE 考试,所以我需要知道这一点。在现实生活中,普通人永远不会这样做:)