note 26003 added to language.operators.increment
| From: | mu at rack1 dot php dot net | Date: | Tue, 15 Oct 2002 02:11:37 +0000 |
| Subject: | note 26003 added to language.operators.increment | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38082@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/language.operators.increment.php
http://master.php.net/manage/user-notes.php?action=edit+26003
http://master.php.net/manage/user-notes.php?action=delete+26003
http://master.php.net/manage/user-notes.php?action=reject+26003