Lori's coworker was a PHP God. His computer was named godbox, which matched his login name of god. A project that took other developers three month to finish, he was sure he could do in three weeks. On one such project, his code utilized all the power of CSS, JavaScript, PHP, and ImageMagic all to generate one graph, that's supposed to show the last 3 month of data.

In this project, each row in the table below represented a row of data per month.

data   yearmonth varchar(5)
  ~~~  |   1003
  ~~~  |   1004
  ~~~  |   1005

The yearmonth column was 2 digit year + 2 digit month concatenated. So March, 2010 would be 1003. It is not clear why it would require 5 characters varchar, but since it was written on a godbox we dare not ask. Of course, the date calculation was really where the fun started.

$yearmonth = "1104"; // this was actually passed in from the front end.
$last_three_yearmonths = array();

for ($i = (int) $yearmonth - 2 ; $i <= (int) $yearmonth; $i++) {
     $last_three_yearmonths[] = (string) $i; }

$sql_three_last_yearmonths = "'".join("', '", $three_last_yearmonths)."'";
// followed by a SQL statement.
$sql = "select * from DataTable where yearmonth in (".$sql_three_last_yearmonths.")";
//     .... more code ....

This, of course, works only about 10 months out of the year, since when you subtract 2 from oh lets say 1101 (January, 2011) you get 1099, and only god@godbox knows when the 99th month of the year will come.