Skip to content

Instantly share code, notes, and snippets.

@antonioribeiro
Created April 14, 2019 14:32
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 antonioribeiro/f69ea450df65280df3f859dbe0704bf1 to your computer and use it in GitHub Desktop.
Save antonioribeiro/f69ea450df65280df3f859dbe0704bf1 to your computer and use it in GitHub Desktop.
in()
function in($needle, ...$haystack): bool
{
foreach ($haystack as $hay) {
if ((is_array($hay) && in($needle, ...$hay)) || $needle == $hay) {
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment