note 37657 added to language.operators.increment

From: Date: Fri, 21 Nov 2003 23:57:33 +0000
Subject: note 37657 added to language.operators.increment
Groups: php.notes 
Request: Send a blank email to php-notes+get-60787@lists.php.net to get a copy of this message
As stated before, the exact moment when post-increment and post-decrement happens is just immediately after the variable is evaluated (not "after the line is processed" or something like that). Keep this in mind during logical processing as well. If the first condition is not met, the variable is incremented and then the next condition is tested, incrementing the variable $i twice before continuing processing: <?php $i = 0; while ($i <= 10) { if (++$i == 1 OR ++$i % 3 === 1) print "**$i**,"; print $i . ','; } ?> Returns: **1**,1,3,5,**7**,7,9,11, ---- Manual Page -- http://www.php.net/manual/en/language.operators.increment.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37657 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37657&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37657&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#60787) next »