PHP 7 Unicode-support and platform-independence

对着背影说爱祢 提交于 2019-12-12 08:07:53

问题


It's announced that PHP 7 supports "consistent 64-bit". What does this mean?

Does PHP 7 support Unicode similar to what was planned for PHP 6 (unicode.semantics directive, etc.)? If not, when will it support Unicode natively?


回答1:


Consistent 64-bit support

I think this relates to RFC: 64 bit platform improvements for string length and integer in zval.

It looks like the visible part of the iceberg is, as @cybersoft has mentioned already, that PHP 7 x64 on Windows now has 64-bit integers, whereas PHP 5.6 x64 still had 32-bit integers on this platform.

There is a RFC for a 64-bit integer type, but it's still work-in-progress since 2010, so it looks like we're still not getting a 64-bit integer on 32-bit platforms here.

Unicode support

AFAIK, there is no such thing as a Unicode implementation similar to what was planned for PHP 6. PHP will still deal with a binary string type for the foreseeable future, and the RFC for UString, which proposes to add a new type for Unicode strings, is still under discussion, so will not make it into PHP 7.0.

PHP however, still works quite well with UTF-8, as long as you use mb_*() functions instead of the basic string functions.

Note that PHP 7 also introduces a Unicode Codepoint Escape Syntax that helps dealing with UTF-8 strings.




回答2:


As I understand it, this means that the 64-bit version of PHP now has 64-bit integers. Previously, there were only 32-bit integers on x64 Windows.



来源:https://stackoverflow.com/questions/31066789/php-7-unicode-support-and-platform-independence

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!