On 18 June 2026 17:13:59 BST, "سپهر محمودی" <[email protected]> wrote:
>Hi everyone,
>
>I would like to propose a new native utility function: str_mask().

I can definitely see the use case for this function - in fact, I was just 
reviewing a change which could have used it.

>Multibyte Support: Unlike custom userland implementations that might
>break on non-Latin strings (like Persian/Arabic/CJK), a native
>implementation can seamlessly handle multibyte characters.

As a rule, PHP's str_* functions operate on byte strings with no knowledge of 
encoding. Multibyte support would belong in the mbstring or intl extensions, 
which have conventions for specifying the encoding in use.

In fact, a correct Unicode implementation would need to operate on "graphemes", 
using the bindings to ICU in the intl extension. Otherwise, it would 
incorrectly handle things like combining diacritics and emoji variation 
selectors.



Rowan Tommins
[IMSoP]

Reply via email to