Both (or neither) statements are being executed. PHP doesn't randomly pick an if() statement in all of your code and decide "Hmm... I'm a bit tired today, how about just executing only one of those statements, eh?" 😉
Why do you think that counter is being unset and display isn't? How are you checking this?