Reputation: 1
My code Is
$co = count($da);
print_r($co);
foreach($da as $abc) {
$myarray = array(
date("j", strtotime($abc - > date)) => ''
);
}
$da have four value but show only one record into calender I use
$data = $this->calendar->generate(2017,12, $myarray);
$this->load->view('calen',['va'=>$data]);
Screen shot of output
Output
Into $da have four date store and pass this array into calender->generate but still show only one date highlight that is last index date so how to solve this problem
Thanks in Advance
Upvotes: 0
Views: 48
Reputation: 171669
You are overwriting the value of $myarray
in every iteration of the loop
Change it to:
foreach($da as $abc) {
$myarray[] = array(
//^^ [] denotes new index in array
date("j", strtotime($abc - > date)) => ''
);
}
Upvotes: 2