Created
April 14, 2019 14:32
-
-
Save antonioribeiro/f69ea450df65280df3f859dbe0704bf1 to your computer and use it in GitHub Desktop.
in()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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