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 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... 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; ?> 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; ?> 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
Archived
This topic is now archived and is closed to further replies.