Collection::merge PHP Method

merge() public method

Returns a new combined collection
public merge ( $collection2 ) : Collection
return Collection
    public function merge($collection2)
    {
        $collection = clone $this;
        $collection->data = a::merge($collection->data, $collection2->data);
        return $collection;
    }

Usage Example

Example #1
0
 public static function newMerged(array $decks)
 {
     $merged = new Collection();
     foreach ($decks as $deck) {
         $merged->merge($deck);
     }
     return new static($merged);
 }
All Usage Examples Of Collection::merge