Recently I just retrofitted some code that was using week numbers for reporting out some values. Unfortunately, the year’s end brought to light some issues related to a difference in how PHP and MySQL calculated the week number. To that end, I created the following table to show that PHP’s date('W') seems to be equivalent to MySQL’s WEEK() function using mode #3.