Kevin S. works on websites for a living.

Well, actually, "work" might not be an adequate description considering that part of Kevin's job requires that he is half clarvoyant and half mountain sherpa when it comes to digging through the several huge codebases globbed together abominations of open source, third-party components that he is expected to support.

Case in point - Kevin was tasked with fixing a bug on a site that, on the surface, seems to work alright, but under the hood it's an organizational nightmare.

The actual website exists in a /site/ subdirectory of the main www folder on the customer's server, which is duplicated two more times under a /site2/ and /site3/ folder, each of which have their own installation of Joomla combined with a mix of randomly installed components and cgi scripts, which may or may not relate to the site's content.

But the best and most WTF inducing discovery is this function he found in a file named "learn.php"...and "learn2.php", and "learn3.php", and "learn.old", and "learn.orig.php"...

<? //convert month number to month name
function monther($inter){
$months = array("Apples", "Jan.", "Feb.", "Mar.", "Apr.", "May.", "Jun.", "Jul.", 
                "Aug.", "Sept.", "Oct.", "Nov.", "Dec.");
        if($inter == 1){
            echo $months[1];
            } else if($inter == 2){
                    echo $months[2];
                    } else if($inter == 3){
                            echo $months[3];
                            } else if($inter == 4){
                                    echo $months[4];
                                    } else if($inter == 5){
                                            echo $months[5];
                                            } else if($inter == 6){
                                                     echo $months[6];
                                                     } else if($inter == 7){
                                                             echo $months[7];
                                            } else if($inter == 8){
                                                     echo $months[8];
                                    } else if($inter == 9){
                                             echo $months[9];
                            } else if($inter == 10){
                                     echo $months[10];
                    } else if($inter == 11){
                             echo $months[11];
            } else if($inter == 12){
                     echo $months[12];
// end converting month
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!