note 114022 added to language.operators.increment

From: Date: Wed, 01 Jan 2014 23:12:24 +0000
Subject: note 114022 added to language.operators.increment
Groups: php.notes 
Request: Send a blank email to php-notes+get-198069@lists.php.net to get a copy of this message
Note: use ++$x instead of $x++ for the "for loop" statement i have a problem before when i tried my code on my localhost and upload it to the server. it's give me different result when you use $x++ in for statement and upload your code to the server hosting. this for loop statement will give you more than 20 loops. <?php ... for($x=0; $x<=20; $x++){ //statement } ... ?> the $x variable will not increasing properly. for example when $x=7 then next loop it should be $x=$x+1 = 8 but with $x++ for loop statement it will give you random $x value it can be $x=0 again and continue increasing randomly. but with this will make your code run fine <?php ... for($x=0; $x<=20; ++$x){ //statement } ... ?> strange increment behavior. i realize it for a day ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/language.operators.increment.php Edit -- https://master.php.net/note/edit/114022 Del: integrated -- https://master.php.net/note/delete/114022/integrated Del: useless -- https://master.php.net/note/delete/114022/useless Del: bad code -- https://master.php.net/note/delete/114022/bad+code Del: spam -- https://master.php.net/note/delete/114022/spam Del: non-english -- https://master.php.net/note/delete/114022/non-english Del: in docs -- https://master.php.net/note/delete/114022/in+docs Del: other reasons-- https://master.php.net/note/delete/114022 Reject -- https://master.php.net/note/reject/114022 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198069) next »