I'm far from a php expert, and dive in only when I want it to perform a specific task for me, then quickly forget what I've just learned until I need to change something.
I have a script set up which allows my clients to review which articles will appear on their sites every Monday for the next 11 weeks. The code is supposed to determine what the Monday is in the current week, then figure out what the Monday is for the next 11 weeks, pull the article title out of mysql (based on their account) and create a link to the article for review.
This is what I came up with (hope it's understandable with my variable names):
//determine the Monday of the current week
$subtract=date("w")-1;
$mondayofthisweek=mktime(0,0,0,date("m"),date("d")-$subtract,date("Y"));
$day=date("d")-$subtract;
$mondaystamp=$mondayofthisweek;
//Find the next 11 Mondays and their tips
while ($mondaystamp<=$mondayofthisweek+6048000){
$mondaystamp=$mondaystamp+604800;
$mondaydate=date("Y-m-d", $mondaystamp);
$mondayday=date("l, F d, Y",$mondaystamp);
=====
And so on... now it can pull up the article title and create a link. It may not be the most efficient method, but for the last couple months, it's worked perfectly. It still works fine up to October 21. Then it jumps to October 27, which is a Sunday, and apparently continues on in seven-day jumps (to the next Sunday). I had determined that adding "604800" to the datestamp would add seven days, but for some reason that ended as of October 21.
Actually, as I write, I've just had an idea... which perhaps someone might confirm/dispute as I continue to explore it. If daylight saving time ends during that week, it would throw off the datestamp by an hour, which means I just have to revisit those numbers and figure out what the hell they actually mean.
Hoping for help...
Vic