src/Subscribo/Support/Arr.php
public static function filterCaseInsensitively(array $needles, array $haystack)
    {
        $result = array();
        $modifiedHaystack = array_change_key_case($haystack, CASE_LOWER);
        foreach ($needles as $needle) {
            $modifiedNeedle = strtolower($needle);
            if (array_key_exists($needle, $haystack)) {
                $result[$needle] = $haystack[$needle];
            } elseif (array_key_exists($modifiedNeedle, $modifiedHaystack)) {
                $result[$needle] = $modifiedHaystack[$modifiedNeedle];
            }
        }
        return $result;
    }
public static function filterCaseInsensitively(array $needles, array $haystack)
    {
        $result = array();
        $modifiedHaystack = array_change_key_case($haystack, CASE_LOWER);
        foreach ($needles as $needle) {
            $modifiedNeedle = strtolower($needle);
            if (array_key_exists($needle, $haystack)) {
                $result[$needle] = $haystack[$needle];
            } elseif (array_key_exists($modifiedNeedle, $modifiedHaystack)) {
                $result[$needle] = $modifiedHaystack[$modifiedNeedle];
            }
        }
        return $result;
    }
public static function filterCaseInsensitively ( array $ needles , array $ haystack ) { $ result = array ( ) ; $ modifiedHaystack = array_change_key_case ( $ haystack , CASE_LOWER ) ; foreach ( $ needles as $ needle ) { $ modifiedNeedle = strtolower ( $ needle ) ; if ( array_key_exists ( $ needle , $ haystack ) ) { $ result [ $ needle ] = $ haystack [ $ needle ] ; } elseif ( array_key_exists ( $ modifiedNeedle , $ modifiedHaystack ) ) { $ result [ $ needle ] = $ modifiedHaystack [ $ modifiedNeedle ] ; } } return $ result ; }
Filter haystack using values in needles in case insensitive manner if needed

Exact match takes precedence,
If exact match is not found, then case insensitive comparison is made

@param array $needles
@param array $haystack
@return array
Filter haystack using values in needles in case insensitive manner if needed