Skip navigation.
Home

The worst way to check odd/even ever.

Hall of Fame

An anonymous user sent this in. The source of the source is unknown. There hasn't been much activity here since I've been quite busy, and writing stuff up for MostGeek.

I gotten quite a few PHPWTFs on how programmers check if a number is odd or even. This one beats the original post, no competition.

The evils of organically grown code...

Wonky Code

Thanks to Tit Petric for sending in this WTF. He's a courageous guy for submitting this because he wrote it himself. This code uses session variables to keep the last used menu item open when the user navigates to a page that isn't on the menu.

While not apparent, this WTF is a good example of what happens to code that grows to fulfill requirements that were not part of the original design. The original code was written to handle a single tier menu system. Then it grew to handle 2-tiers, 3-tiers, 4-tiers, etc. Right now the production code is sitting at 5-tiers *shudder*.