• King (unregistered)

    Geniuses are always misunderstood the frist time.

  • (nodebb)

    To be fair, technically PHP doesn't have arrays - an array is just a dictionary/map with a numeric key. But the whole construct still looks weird, especially without any additional context...

  • Variant (unregistered)

    Sadly, a daily total would end up as a W Th F, thanks to that pesky Tuesday coming first.

  • (nodebb)

    $comments = array("frist" => "Moderation", "secnod" => "Comment", "thrid" => "Moderation")

  • Brian Boorman (unregistered)

    Why not use Ja, Fe, Mr, Ap, My, Ju, Jl, Au, Se, Oc, No, and De for the keys?

  • LZ79LRU (unregistered)

    I disagree with the article. I did not write this code but I still love it. I especially love the attention to detail that it took to make sure he only used a second character where absolutely necessary. It would have been so easy to spell it all in two letters or worse yet whole words wasting space unforgivably.

    This said, I would have used fv for five and tr for three. Those letter combinations phonetically sound more like the numbers they represent in my view. But that's just personal preference.

  • Sauron (unregistered)

    some total of the sales of some commodity

    <irony>The commodity market is in good hands</irony>

  • (nodebb)

    I semi-agree w LZ79LRU. It's bad is a good way which is better than our usual badness in a bad way.

    Had the names been inconsistent, or one of them misspelled or them out of order in the constructor, that would have been the usual haphazard chaos-of-mind we're used to critiquing. No chaos here; just weirdness.

    The only legit motivation / saving grace I can imagine for this idea is to distinguish between "months" as in absolute calendar months (1=Jan, 2=Feb, ...) versus relative months. Today being in Dec as I write, that's "o" = Nov, "t"= Oct, etc. It's essentially the same motivation as Systems Hungarian, decorating the key with a semantic meaning.

    To be sure, a properly named enum for key values {OneMonthAgo, TwoMonthsAgo, ...} or an object with properties OneMonthAgo, TwoMonthsAgo etc would be a better tool to do the same thing. And with some accessor / converter methods to take an index month and offset month as DateTime objects or as ints and deliver up the right results.

    But if we had that, we'd have no WTF.

  • Mr Bits (unregistered)

    It's job security. And if they do let you go anyway, then you have a bit of instant karma.

  • (nodebb) in reply to Mr Bits

    Sure, but instant karma may be negative...

  • Tim R (unregistered)

    Actually this solution makes perfect sense when you consider that... um... no wait..., ok I give up

  • oh no (unregistered)

    Job security by obscurity

  • (nodebb)

    OK. You got me. This is the first one where my jaw quite literally dropped.

    This is f@&#ing INSANE.

  • (nodebb)

    ('o' => 23141, 't' => 23142, 'th' => 42432, 'f' => 63243, 'fi' => 21422);

    "o"ne "t"wo "th"ree "f"our "fi"ve

    Makes perfect since in a twisted sort of sense.

  • eric bloedow (unregistered)

    reminds me of an older story where someone wrote a program to verify the Months, BUT he ran all them all together, "janfebmar"etc, so "anf" and "nfe" would pass!

  • erffrfez (unregistered)
    Comment held for moderation.

Leave a comment on “Monthly Totals”

Log In or post as a guest

Replying to comment #:

« Return to Article