Skip to content

Instantly share code, notes, and snippets.

@vfalconi
Created July 24, 2018 16:09
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 vfalconi/38ef1e6d776023beb2d353aaadd2db6d to your computer and use it in GitHub Desktop.
Save vfalconi/38ef1e6d776023beb2d353aaadd2db6d to your computer and use it in GitHub Desktop.
// finds interesection between the keys of $array and the values of $comparisonList
function array_keys_intersect_list($array, $comparisonList)
{
$intersections = [];
foreach ($comparisonList as $item) {
if (array_key_exists($item, $array)) $intersections[] = $item;
}
return $intersections;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment