SuperBlue Posted September 21, 2010 Share Posted September 21, 2010 I have a switch, which i use to alternate between two numbers. But for some reason, a duplicate occurs exactly at the count of 4, and i haven't been able to figure out why. $Count = 1; switch ($Count) { case 1: ++$Count; break; case 2: --$Count; break; } Should output: 2 1 2 1 2 ... But for some reason it gives the below instead.. 2 1 2 1 1 2 1 ... Subsequent output after the error appears completely normal. Quote Link to comment Share on other sites More sharing options...
rwwd Posted September 21, 2010 Share Posted September 21, 2010 Stupid suggestion I Deleted my comment.. Quote Link to comment Share on other sites More sharing options...
SuperBlue Posted September 21, 2010 Author Share Posted September 21, 2010 I was just a bit to quick when writing the source. The switch was placed the wrong place, so it allowed inclusion of inactive posts, before it calculated the current count. I nearly thought that either PHP, or I got the math wrong.. Quote Link to comment 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.