Check out Scrivo

Do you want to try out Scrivo? Then here's a demo for you that does not just get your feet wet but lets you plunge right in.

Contact us

For more information, please contact us. We're happy to help you out!

Next Oct 30 Previous

Baby boomer blues

The function mktime() used to return the wrong value for dates before Jan 01, 1970 on Windows systems. What can you say about this issue?

A: This is not true, it is still broken.
B: This was a PHP 4 issue.
C: This is fixed since PHP 5.1.
D: Quit bashing Windows, this was never a problem.

Answer

In older versions of PHP mktime() was just plain broken on Windows (and some other OS's or OS builds). On fora you can still find explanations and they usually point to the underlying architecture (e.g. Windows) as the root cause, taking the blame off PHP in the process.

That story always seemed like a load of bollocks to me. I'm not a Windows man but believe me, Windows can store the birth date of B. Gates. That was never the problem.

Apparently PHP pleaded guilty and fixed the bug. I came to this conclusion because mktime() works on Windows since PHP 5.1 and Windows didn't change, in fact it is as bad as it always was. So answer C is correct.

PHP never took the issue of portability very seriously in the past. When you started coding PHP you had to marry your OS (with sys admin: ini settings) too. Slowly this is changing for the better.