This should give you some food for thought:
<?php
function lastTuesday($month, $year)
{
if(!checkdate($month, 1, $year))
{
return(FALSE);
}
return date('Y/m/d', strtotime('Last Tuesday',
strtotime('+1 Month', strtotime("$year/$month/1"))));
}
echo "<ul>\n";
foreach(array(1,2,3,4,5,6,7,9,10,11) as $mo)
{
echo "<li>".lastTuesday($mo, 2007)."</li>\n";
}
echo "</ul>";
Outputs is:
2007/01/30
2007/02/27
2007/03/27
2007/04/24
2007/05/29
2007/06/26
2007/07/31
2007/09/25
2007/10/30
2007/11/27