I'd like to address an issue I have with this RFC.

I'm not sure is solves a problem by itself. If I understand all of this 
correctly this only does what already can be accomplished with 
preg_match_all('/\X/u', ...). The result of this method in my opinion is not 
very usefull by itself. I've done some searching on various code platforms 
where I mostly find the use-case for counting the number of grapheme's. I've 
used it to implement strrev() that correctly works multibyte. 

I'm very sad that mbstring works on codepoints instead of grapheme's and I 
would very much like to see something happening in that area, but I think 
expanding a simple string to an array of as many elements to give developers a 
tool to do this in PHP-space is not good enough. Especially since it can 
already be achieved with a regexp that already works.

In my opinion: This adds nothing, and tells the PHP developer that is ok to do 
count(grapheme_str_split()) for a more accurate mb_strlen().

I would like to see a family of functions that can do multibyte str_split(), 
strrev(), substr(). Ideally as bugfix in mb_* functions, because the edge-case 
of wanting to know the length in codepoints of a string is a weird edge-case. 
No developer wants to know that. mb_strlen() should have returned the number of 
graphemes from the start.


On Tue, Mar 26, 2024, at 01:44, youkidearitai wrote:
> 2024年3月26日(火) 5:43 David CARLIER <devne...@gmail.com>:
> >
> > I second this, I think it is a good addition which makes a lot of sense.
> >
> > Cheers.
> >
> > On Mon, 25 Mar 2024 at 20:36, Ayesh Karunaratne <ayesh@php.watch> wrote:
> >>
> >> >
> >> > 2024年3月9日(土) 15:26 youkidearitai <youkideari...@gmail.com>:
> >> > >
> >> > > Hello, Internals
> >> > >
> >> > > I created an wiki for `grapheme_str_split` function.
> >> > > Please see:
> >> > > https://wiki.php.net/rfc/grapheme_str_split
> >> > >
> >> > > I would like to "Under Discussion" section.
> >> > >
> >> > > Best Regards
> >> > > Yuya
> >> > >
> >> > > --
> >> > > ---------------------------
> >> > > Yuya Hamada (tekimen)
> >> > > - https://tekitoh-memdhoi.info
> >> > > - https://github.com/youkidearitai
> >> > > -----------------------------
> >> >
> >> > Hello, Internals
> >> >
> >> > I want to go to "Voting" phase if nothing any comment.
> >> > I will start at tomorrow(26th) to "Voting" phase.
> >> >
> >> > Thank you
> >> > Yuya
> >> >
> >> > --
> >> > ---------------------------
> >> > Yuya Hamada (tekimen)
> >> > - https://tekitoh-memdhoi.info
> >> > - https://github.com/youkidearitai
> >> > -----------------------------
> >>
> >> I think it makes sense to add this function, and the PR worked well
> >> too; It correctly split individual graphemes for all comlex Emojis,
> >> ZWJs, and those Cthulu texts, and everything else I threw at it.
> >>
> >> Good luck for the RFC vote today, hope it passes 🤞.
> 
> 
> Hi, Internals
> 
> grapheme_str_split going to "Voting" phase.
> Vote end is 10th April 00:00 GMT
> 
> Regards
> Yuya
> 
> -- 
> ---------------------------
> Yuya Hamada (tekimen)
> - https://tekitoh-memdhoi.info
> - https://github.com/youkidearitai
> -----------------------------
> 

Reply via email to