forumnz Posted January 26, 2008 Share Posted January 26, 2008 This should make the variable c2, c3, c2, c3, c2 etc, but only displays c2. $col = (($count++)%2==0)?"c2":"c3"; Whats wrong with it? Quote Link to comment https://forums.phpfreaks.com/topic/87854-small-count-problem/ Share on other sites More sharing options...
hitman6003 Posted January 26, 2008 Share Posted January 26, 2008 Works fine for me: <?php $count = 0; for ($i = 0; $i <= 10; $i++) { echo (($count++) % 2 == 0) ? "c2 " : "c3 "; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/87854-small-count-problem/#findComment-449429 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.