public static function arraySearch($needle, array $haystack, $caseSensitive = true)
    {
        foreach ($haystack as $key => $value) {
            $searchFunc = ($caseSensitive) ? 'strpos' : 'stripos';

            if ($searchFunc($value, $needle) === 0) {
                return $key;
            }
        }

        return false;
    }