linux1880 Posted January 21, 2010 Share Posted January 21, 2010 I have seen lots of exmple where people use $i++ and values keeps increase without using loops but when i do, it doesn't happen. In what case do we use such incrementation ? can anyone explain me with example pls ? Thanks Regards Quote Link to comment https://forums.phpfreaks.com/topic/189312-in-what-case-can-i-increment-value-of-i-without-using-loops/ Share on other sites More sharing options...
deansatch Posted January 21, 2010 Share Posted January 21, 2010 If it continually increases using $i++ then it will be using a loop. e.g. while, for, foreach etc... Quote Link to comment https://forums.phpfreaks.com/topic/189312-in-what-case-can-i-increment-value-of-i-without-using-loops/#findComment-999370 Share on other sites More sharing options...
JonnoTheDev Posted January 21, 2010 Share Posted January 21, 2010 eh? <?php $i = 0; $i++; // will print 1 print $i; ?> Quote Link to comment https://forums.phpfreaks.com/topic/189312-in-what-case-can-i-increment-value-of-i-without-using-loops/#findComment-999372 Share on other sites More sharing options...
roopurt18 Posted January 21, 2010 Share Posted January 21, 2010 <?php $i = 0; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; $i++; echo $i; ?> Quote Link to comment https://forums.phpfreaks.com/topic/189312-in-what-case-can-i-increment-value-of-i-without-using-loops/#findComment-999388 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.