Kevin Houde
Kevin Houde

Reputation: 319

How to concatenate two arrays value into an other one

I use Fullcalandar and i need concatenate two array into $eventsArray['title']

I need to do something like that for title ( this method don't work...)

$eventsArray['title'] = $items['subject'] + $items['eventname'];

My code

foreach ($eventgroup as $items){

  $eventsArray['title'] =  $items['eventname'];
  $eventsArray['start'] =  $items['date'];
  $eventsArray['weekends'] =  'false';
  $events[] = $eventsArray;
}

How can I do this please ? Thx

Upvotes: 2

Views: 900

Answers (3)

Explosion Pills
Explosion Pills

Reputation: 191729

Slightly more readable method:

$eventsArray['title'] = "$items[subject] $items[eventname]";

Upvotes: 1

Nicola Peluchetti
Nicola Peluchetti

Reputation: 76870

To concatenate use the dot

 $eventsArray['title'] = $items['subject'].$items['eventname'];

Upvotes: 1

RiaD
RiaD

Reputation: 47619

....
$eventsArray['title'] =  $items['subject']. ' ' .$items['eventname'];
...

Read this Manual

Upvotes: 1

Related Questions