Skip navigation.
Home

Hall of Fame

That is some classy code...

Hall of Fame | Bad Architecture | Fugly Code | Wonky Code

Thanks to Andreas D. for sending this one in. This PHP code generates a heirachical menu in a not so nice way.

  • WTF #1 is for being very 'fugly' code. Nobody should indent with more than 4 spaces!
  • WTF #2 is the menu class. This class really has no point other than to hold two values which can be done with a simple array. See my example below.
  • WTF #3 is this $menu[$i][$j][0][0][0]->target. There's nothiing like a 5 dimensional array to make a really simple thing like menu generation really difficult.

Be sure to shield your eyes and don't look directly at this code...

When a function just won't do...

Hall of Fame | Bad Architecture

Thanks to Michael for sending this in! He was doing a code audit on a PHP application developed by a contractor. Our story starts with an include file named magdit.inc, which is Dutch for "isthisallowed".

This example makes it into the WTF Hall of Fame because it violates so many good design principles. Take a look at magdit.inc to get you started...

XML feed