FOF30\Utils\Collection::diff PHP Méthode

diff() public méthode

Diff the collection with the given items.
public diff ( Collection | array $items ) : Collection
$items Collection | array
Résultat Collection
    public function diff($items)
    {
        return new static(array_diff($this->items, $this->getArrayableItems($items)));
    }

Usage Example

Exemple #1
0
 public function testDiffCollection()
 {
     $c = new Collection(array('id' => 1, 'first_word' => 'Hello'));
     $this->assertEquals(array('id' => 1), $c->diff(new Collection(array('first_word' => 'Hello', 'last_word' => 'World')))->all());
 }