Last active
July 26, 2021 06:56
-
-
Save gh-o-st/18325054388b56196c3e7fb168a05f25 to your computer and use it in GitHub Desktop.
Just a quick n' dirty recursive version of array_key_exists()
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
| <?php | |
| function array_key_exists_r($array, $keySearch) { | |
| if (is_array($array)) { | |
| foreach ($array as $key => $item) { | |
| return ($key == $keySearch) ? true : (array_key_exists_r($item, $keySearch)) ? true : false; | |
| } | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment