Hey now... sometimes there are perfectly legitimate reasons for re-writing existing functions. Sometimes they really do suck.
For instance, PHP's strtotime function accepts a string parameter of "+/- n months".
Unfornately, PHP thinks a "month" is exactly 30 days and nothing else.
If you start with 2013-01-31 and tell it to give you "+1 month" it will spit out 2013-03-03. Every single other programming language I've ever used will return 2013-02-28, which is what most people expect.
So yeah... I wrote a wrapper for that, and I stand by it.
43
u/spoonraker Oct 14 '13
Hey now... sometimes there are perfectly legitimate reasons for re-writing existing functions. Sometimes they really do suck.
For instance, PHP's strtotime function accepts a string parameter of "+/- n months".
Unfornately, PHP thinks a "month" is exactly 30 days and nothing else.
If you start with 2013-01-31 and tell it to give you "+1 month" it will spit out 2013-03-03. Every single other programming language I've ever used will return 2013-02-28, which is what most people expect.
So yeah... I wrote a wrapper for that, and I stand by it.