Si no me equivoco fechas puede suponer que tendrá un lunes pasando cada 7 días.

Y también puede safley asumir que sólo tendrá un lunes cada 7 días.
De todos modos aquí es un código que le imprime si el lunes por primera vez este mes:
if ( date("D") === "Mon" && (date("j")) < 8 )
{
echo "Today is the the first Monday this month!";
}
- if ( date("D") === "Mon" && (date("j")) < 8 )
- {
- echo "Today is the the first Monday this month!";
- }
El código anterior sólo comprobará el día de hoy y si es su el primer lunes de este mes, a continuación, se activan y decir que hoy en día... bla bla bla. No se pide para eso.
De todos modos aquí es un código que escribí a toda prisa:
$day = 1;
$month = 1;
$yearNow = 2011; //start counting from this year
$countToYear = 2020; // stop when reaching this year
while ($yearNow < $countToYear)
{
if ( $month == 6 ) //skip June (for some reason?)
{
$month++;
continue;
}
if ( date("l", mktime(0, 0, 0, $month, $day, $yearNow)) == "Monday" ) // prints out IF monday
{
echo date("Y-m-d", mktime(0, 0, 0, $month, $day, $yearNow));
echo "<br />";
}
$day++;
if ($day > 7) /* there are more than 7 days in a month but the first monday will happen in the first 7 days, so start over. with new month please */
{
$day = 1;
$month++;
if($month > 12)
{
$month = 1;
$yearNow++;
}
}
}
- $day = 1;
- $month = 1;
- $yearNow = 2011; //start counting from this year
- $countToYear = 2020; // stop when reaching this year
- while ($yearNow < $countToYear)
- {
- if ( $month == 6 ) //skip June (for some reason?)
- {
- $month++;
- continue;
- }
- if ( date("l", mktime(0, 0, 0, $month, $day, $yearNow)) == "Monday" ) // prints out IF monday
- {
- echo date("Y-m-d", mktime(0, 0, 0, $month, $day, $yearNow));
- echo "<br />";
- }
- $day++;
- if ($day > 7) /* there are more than 7 days in a month but the first monday will happen in the first 7 days, so start over. with new month please */
- {
- $day = 1;
- $month++;
- if($month > 12)
- {
- $month = 1;
- $yearNow++;
- }
- }
- }
Su no bastante, pero debe dar una lista mirando como:
2011-01-03
2011-02-07
2011-03-07
2011-04-04
2011-05-02
2011-07-04
2011-08-01
2011-09-05
2011-10-03
07-11-2011
2011-12-05
2012-01-02
06-02-2012
05-03-2012
02-04-2012
07-05-2012
02-07-2012
06-08-2012
03-09-2012
2012-10-01
2012-11-05
2012-12-03
07-01-2013
04-02-2013
04-03-2013
2013-04-01
2013-05-06
etc.
Se trata de la primera vez que sucede un lunes de cada mes. Como se puede ver 20XX-06-XX se omite porque no desea calcular cuando sucede en junio. Esto se hace mediante el uso de un articulo de continuar:
if ( $month == 6 )
{
$month++;
continue;
}
- if ( $month == 6 )
- {
- $month++;
- continue;
- }
Puede comprobar las fechas más en el tiempo o volver atrás en el tiempo más alterando $yearNow y $countToYears inicial de valores iniciales. Yo dejaría el día $ = 1; y $mes = 1; valores de ser como es, sólo dicen que se inicie el primer "analizar" con 1 mes y 1 día.