Skip to content

Instantly share code, notes, and snippets.

@jeystaats
Last active February 25, 2017 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeystaats/7dc724500286432cddca50e9c86f3bd3 to your computer and use it in GitHub Desktop.
Save jeystaats/7dc724500286432cddca50e9c86f3bd3 to your computer and use it in GitHub Desktop.
Difference in Collection ( Laravel )
<?php
$array1 = ['Rocket','Thruster','Space'];
$array2 = ['Rocket','Rocks','Space'];
$collection = collect($array1);
$intersect = $collection->intersect($array2);
var_dump($intersect )
// $intersect = ['Rocket','Space'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment