This RFC is about adding a 64bit integer type to PHP.
Currently PHP's int type is 32bit on x86 systems, and 64bit on x64 systems. Sometimes you will need to handle numbers thats bigger than the 32bit integer limit and have to either use dirty hacks like converting to a float/string or use extensions like BCMath for such operations.
This RFC proposes a new type (“int64”), which always is 64bit long no matter the host arch.
To remain consistent and not changing the current integer type declarings, a new prefix will be available for declaring 64bit long integers:
<?php $int64 = L199938937393792738748327842; var_dump($int64, L209938836626262738748327842); /* int64(199938937393792738748327842) int64(209938836626262738748327842) */ ?>
Like the integer type, you may also cast to a 64bit integer:
<?php $int64str = '199938937393792738748327842'; var_dump((int64) $int64str); /* int64(199938937393792738748327842); */ ?>
The type cast have a “long” name alias too: (integer64)
New function(s) should be inserted into the core
The 64bit integer will internally be stored as 'zend_long64', as currently defined in zend_types.h
The API will be identical to the current type handling functions/macros that already exists:
To parse the 64bit integer via the parameter_parsing API, the 'i' modifier will be in place like the 'l' for 'long'. Aswell as the 'I' modifier for limiting out of range values to minimum/maxmimum values of a zend_long64
Currently no patch is available, but it is in the works.