mktime in php5
Came across a little bug in some of my code written a few years ago, after the server was upgraded to the PHP5 series, Brief details below:
In PHP 4.3.9:
<?php
date("F", mktime(0,0,0,1, 1, 1, 1));
// output: January
?>
In PHP 5.2.1:
<?php
date("F", mktime(0,0,0,1, 1, 1, 1));
// output: December
?>
This isn’t the exact code, so the logic of such a call won’t make much sense, but obviously, I was asking for it, with the bad assumptions. A quick work around was simply:
<?php
date("F", mktime(1,0,0,1, 1, 1, 1));
// output: January
?>
No comments yet
