RE: [PHP-I18N] proposal: unification of the grapheme_extract functions
| From: | Ed Batutis | Date: | Tue, 13 May 2008 21:26:55 +0000 |
| Subject: | RE: [PHP-I18N] proposal: unification of the grapheme_extract functions | ||
| References: | 1 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-1212@lists.php.net to get a copy of this message | ||
> A variation of the proposal might be ...
I like it. I vote for:
Add a new optional parameter on the end - called $next - that
is a reference that will receive the offset just past the
end of the returned string.
The caller can use the same variable for $start and $next if they don't want
to have to manually assign the value in their own code.
I will add the three options for the meaning of 'start' as well with the
default being 'byte'. The returned $next value will respect the value of
that option.
If no one objects I'll put that in.
> The right solution (to my mind) is to have some meta data maintained with
> strings and store position and other info about the strings to improve
> performance without involving programmers and letting people program
> strings without caring about encoding or architecture. That is an
> opportunity for php 6.
Sounds like a break iterator with a bit of extra info to support multiple
encodings. Or perhaps you mean to wrap all string operations?
=Ed