Re: [Discussion] Proposal: grapheme_mask() helper function

From: Date: Thu, 25 Jun 2026 11:39:21 +0000
Subject: Re: [Discussion] Proposal: grapheme_mask() helper function
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-131531@lists.php.net to get a copy of this message
Hi Nick, Ilija, and everyone, Thank you for the quick feedback, Nick! I completely agree with your suggestion. Having both str_mask() for general byte-based masking and grapheme_mask() for Unicode-aware operations is the perfect approach to cover all use cases in PHP. I have already prepared the implementation, stubs, and tests for grapheme_mask. Regarding your suggestion, I’m more than happy to work on str_mask as well and include both in the proposal. However, I'm currently facing a technical issue with the PHP Wiki. My account (sepehrphp) seems to be inactive or pending activation, which is preventing me from logging in and publishing the RFC. @Ilija, could you please check my account status? As soon as the login issue is resolved, I will post the RFC covering both functions so we can discuss the implementation details there. Best regards, Sepeh On Thu, Jun 25, 2026 at 9:29 AM Nick Sdot <php@nicksdot.dev> wrote: > On 19.06.26 17:51, سپهر محمودی wrote: > > > While thinking about this problem, I designed a function concept > > called grapheme_mask(). The goal of this function is to provide a > > clear, native, and Unicode‑safe way to mask sections of a string. > > > > Best regards, > > > > Sepehr > > Hey Sepehr, > > Is this grapheme_mask proposal meant as a replacement for the > str_mask you proposed before or as an addition? > A mask function seems helpful to me. But I think this should not be > exclusive to the intl extension, and str_mask still be added, > too. > > -- > > Cheers > Nick > >

« previous php.internals (#131531) next »