Previous: , Up: Overloading Operators   [Contents]


4.4 Unary Assignment Operators

SyntaxInstruction
++$aZEND_PRE_INC
$a++ZEND_POST_INC
--$aZEND_PRE_DEC
$a--ZEND_POST_DEC

Unary assignment operators differ from each other. Post-increment/decrement operators behave identical to non-assignment unary operators, while pre-increment/decrement operators behave identical to binary assignment operators with the exception that they accept only one operand.

This behavior is not hard to understand, as in normal circumstances, the operand of a pre-increment/decrement operator is returned as execution result (with type IS_VAR), while a post-increment/decrement operator has to copy itself to a temporary variable and return it as execution result (with type IS_TMP_VAR).