note 26003 deleted from language.operators.increment by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 15:20:25 +0000 |
| Subject: | note 26003 deleted from language.operators.increment by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189848@lists.php.net to get a copy of this message | ||
Note Submitter: mu at despammed dot net
----
The exact moment when post-increment and post-decrement happen is _just immediately after the
variable is evaluated_ (not "after the line is processed" or something like that)
Example 1:
$i = 2;
echo $i++ + $i;
Result: 5. The first i is evaluated as 2, gets incremented to 3. i is then evaluated as 3 for the
second occurance.
Example 2:
$i = 2;
echo $i + $i++;
Result: 4. The first i is 2. Second i is 2 too, gets incremented afterwards.