Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP 7 Unicode-support and platform-independence

Tags:

php

php-7

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?

like image 416
Handsome Nerd Avatar asked Jun 26 '15 06:06

Handsome Nerd


2 Answers

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.

like image 144
BenMorel Avatar answered Nov 01 '22 06:11

BenMorel


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.

like image 36
cybersoft Avatar answered Nov 01 '22 04:11

cybersoft