function next_ten_first_sat(){
$next_month = strtotime(date('Y-m-d'));
$j=0;
for($i=1;$i<10;$i++){
if($i==1){
$sat_next_month[$i] = strtotime('next month first saturday', $next_month);
$next_month = strtotime(date('Y-m',$sat_next_month[$i]).'-01');
}else{
$sat_next_month[$i] = strtotime('next month first saturday', $next_month);
$next_month = strtotime(date('Y-m',$sat_next_month[$i]).'-01');
$result_year = date('Y', $sat_next_month[$i]);
if(date('m', $sat_next_month[$i])>10){
$result_month = date('m', $sat_next_month[$i])-1;
}else{
$result_month = date('m', $sat_next_month[$i])-1;
$result_month = '0'.$result_month;
}
$result_date = date('d', $sat_next_month[$i]);
$result_array[$j] = $result_year.'-'.$result_month.'-'.$result_date;
}
$j++;
}
return $result_array;
}
Извините, ребята, впервые неправильно прочитали вопрос.Это должно работать как задумано, но это очень грязно ... Пожалуйста, оптимизируйте это, ребята .....