I try to create a list with nested foreach loop. First loop is looping some numbers, second loop is looping dates. I want to write one number to one date. So there is a another function to check that. But the result is numbers writes on dates multiple times.
Out is something like that :
number 5 is on 2013.01.15;
number 5 is on 2013.01.16;
number 5 is on 2013.01.17;
number 6 is on 2013.01.15;
number 6 is on 2013.01.17;
The code :
function create_event($numbers,$available_dates) {
foreach($numbers as $number) {
foreach($avaliable_dates as $av_date) {
$date_check= dateCheck($av_date,$number);
if ($date_check == 0) {
echo "number ".$number." is on ".$av_date;
break;
} else {
$send_again[] = $number;
}
}
}
create_event($send_again,$avaliable_dates);
}
I think inside loop is not break.
continue;but nothing changed.