====== PHP RFC: Add locale for case insensitive grapheme functions ======
* Version: 0.9
* Date: 2025-06-07
* Author: Yuya Hamada, youkidearitai@gmail.com
* Status: Draft
* First Published at: https://wiki.php.net/rfc/grapheme_add_locale_for_case_insensitive
===== Introduction =====
A grapheme functions is not locale dependency. This RFC is add locale parameter for grapheme case insensitive functions.
* grapheme_stripos
* grapheme_strripos
* grapheme_stristr
By this RFC can cover locale. For example.
var_dump(grapheme_stripos("i", "\u{0130}", 0, "tr_TR")); // Result is 0
var_dump(grapheme_stripos("i", "\u{0130}", 0, "en_US")); // Result is false
If this RFC is accept, I would go to new RFC for grapheme_icontains (Locale dependency and case-insensitive of str_contains). Because grapheme function is not locale dependency now.
===== Proposal =====
Add a $locale parameter in these functions.
function grapheme_stripos(string $haystack, string $needle, int $offset = 0, ?string $locale = null): int|false
function grapheme_strripos(string $haystack, string $needle, int $offset = 0, ?string $locale = null): int|false
function grapheme_stristr(string $haystack, string $needle, bool $beforeNeedle = false, ?string $locale = null): string|false
===== Backward Incompatible Changes =====
Maybe nothing.
===== Proposed PHP Version(s) =====
8.5
===== RFC Impact =====
==== To SAPIs ====
No effects.
==== To Existing Extensions ====
No effects.
==== To Opcache ====
No effects.
==== New Constants ====
No effects.
===== Open Issues =====
Nothing.
===== Future Scope =====
This section details areas where the feature might be improved in future, but that are not currently proposed in this RFC.
===== Proposed Voting Choices =====
Include these so readers know where you are heading and can discuss the proposed voting options.
===== Patches and Tests =====
https://github.com/php/php-src/pull/18792
===== Implementation =====
https://github.com/php/php-src/pull/18792
===== References =====
https://unicode-org.github.io/icu/userguide/transforms/casemappings.html#full-language-specific-case-mapping
===== Rejected Features =====
Keep this updated with features that were discussed on the mail lists.