note 94583 added to language.operators.increment
| From: | jellestege at gmail dot com | Date: | Thu, 12 Nov 2009 23:25:43 +0000 |
| Subject: | note 94583 added to language.operators.increment | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162835@lists.php.net to get a copy of this message | ||
at daevid at daevid dot com,
"Why would you EVER want $num = $num++; to give you back the value you already had? "
Consider the following script:
<?php
$i = 0;
while ( $i < 10 ) {
printf("%d",$array[$i++]);
}
?>
If you increment $i before returning it, the initial value of $i should be -1.
----
Server IP: 213.249.64.162
Probable Submitter: 94.214.172.63
----
Manual Page -- http://www.php.net/manual/en/language.operators.increment.php
Edit -- https://master.php.net/note/edit/94583
Del: integrated -- https://master.php.net/note/delete/94583/integrated
Del: useless -- https://master.php.net/note/delete/94583/useless
Del: bad code -- https://master.php.net/note/delete/94583/bad+code
Del: spam -- https://master.php.net/note/delete/94583/spam
Del: non-english -- https://master.php.net/note/delete/94583/non-english
Del: in docs -- https://master.php.net/note/delete/94583/in+docs
Del: other reasons-- https://master.php.net/note/delete/94583
Reject -- https://master.php.net/note/reject/94583
Search -- https://master.php.net/manage/user-notes.php