Created
September 3, 2018 17:13
-
-
Save dankerizer/110772724c2aa37117376f0ff12146bb to your computer and use it in GitHub Desktop.
find array key by value
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 themeid_find_array($array, $field, $value) | |
| { | |
| if (is_array($array)) { | |
| foreach ($array as $key => $item) { | |
| if ($item[$field] === $value) | |
| return $key; | |
| } | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment