Re: [RFC] IntlChar class and intl_char_*() functions

From: Date: Thu, 27 Nov 2014 15:17:09 +0000
Subject: Re: [RFC] IntlChar class and intl_char_*() functions
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-79233@lists.php.net to get a copy of this message
Andrea Faulds wrote on 27/11/2014 13:48:
On 27 Nov 2014, at 08:22, Stanislav Malyshev <smalyshev@gmail.com> wrote: Looking into this and also reading the \u{} proposal, I also thought - do we have a programmatic way of doing what \u would do? I.e. if we assume $x holds an Unicode codepoint value (i.e., an integer) do we have a good built-in way to generate the corresponding utf8 sequence? If not, then I think this class may be a good place to put such a function in.
You mean something along the lines of JavaScript’s String.fromCharCode (or, in ES6, String.fromCodePoint)? One of the nice things about that function is that it can take multiple codes. So I can do String.fromCodePoint(65, 66, 67) to get “ABC”. If we add that, we should also have an analogue of JavaScript’s String.charCodeAt/String.codePointAt to do the operation in reverse.
We already have the single-byte versions: chr() and ord(). It's been on my to do list for a while to rewrite the manual pages for those, which currently have a whole lot of misleading references to ASCII.

« previous php.internals (#79233) next »