Hm, the code line in the OP obviously was taken verbatim from
a reply I gave to one of your previous questions.
I deliberately crafted the code in that node after the the snippet you gave in that question, to give you a better resemblance what change I proposed to your code.
I even let things in there not used in my code, like the variables $year and friends.
But then, my code was a tested complete script, which you are able to save and execute as-is. So I thought it was clear, that some things have to be taken in its own context and can't be transplanted into another (your) script without adaption.
It seems I failed miserably with this approach.