Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkArray(Array $originArray): bool
- {
- //convert array to lowercase with save type
- $array = array_map(function($item) {
- return is_string($item) ? strtolower($item) : $item;
- }, $originArray);
- //calculate duplicates and return result
- foreach ($array as $item) {
- $duplicates = array_keys($array, $item, true);
- if (count($duplicates) % 2 == 0) {
- return true;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement