function phutil_utf8_console_strlen($string)Arcanist Technical Documentation ()
function phutil_utf8_console_strlen($string)
Arcanist Technical Documentation ()
Find the console display length of a UTF-8 string. This may differ from the character length of the string if it contains double-width characters, like many Chinese characters.
This method is based on a C implementation here, which is based on the IEEE standards. The source has more discussion and addresses more considerations than this implementation does.
http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
NOTE: We currently assume width 1 for East-Asian ambiguous characters.
NOTE: This function is VERY slow.
Parameters
string | $string | A valid UTF-8 string. |
Return
int | The console display length of the string. |
- Defined
- src/utils/utf8.php:316