Try this code
function getDay($year = 2006, $month = 1, $checkDay = 'Sun', $repeat = 3) {
$dateFormat = date('Ymd', strtotime($year . $month . '01'));
$currentMonth = $month;
$month = $currentMonth;
if ($currentMonth < 10) {
$month = '0' . $currentMonth;
}
$daysInMonth = date('t', $dateFormat);
$dayStore = array();
$j = 1;
for ($i = 1; $i <= $daysInMonth; $i++) {
$day = $i;
if ($i < 10) {
$day = '0' . $i;
}
if (date('D', strtotime($year . $month . $day)) == $checkDay) {
$dayStore[$j] = $i;
$j++;
}
}
return $dayStore[$repeat];
}
//
-- This message may have been cut off and the rest will only be shown to members. To become a member, click here --