0

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

0

1 Answer 1

2

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)) => ''
  );
}
Sign up to request clarification or add additional context in comments.

1 Comment

But when i can use this $myarray in the generate calendar that time only one date highlight or only one value are show i use foreach loop in $dat=$this->calendar->generate(2017,12, $value); then only one date are highlight @charlietfl

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.