Re: [RFC] Big Integer Support

From: Date: Tue, 14 Oct 2014 19:46:14 +0000
Subject: Re: [RFC] Big Integer Support
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-78056@lists.php.net to get a copy of this message
On 14 Oct 2014, at 19:53, Lester Caine <lester@lsces.co.uk> wrote: > The real life situation is that databases have used a 64bit integer as > the primary key for records in a table for a long time now. Loading > these records into arrays using the primary key as the array key is a > natural process but as you have identified currently once they go over a > 32 bit value they switch from simple integer to strings. Upgrading PHP > to natively support 64bit integers on 64bit platforms but leaving them > as 32bit on 32bit platforms is creating an inconsistency which this rfc > seems to be making more complex rather than less. This why I was simply > looking for a 64bit integer type that works as a simple integer on 32bit > platforms as well. GMP is overkill for this simple case and only needed > when one actually needs integers bigger than 64bit, and normal > programming does not need that in PHP7, just a clean 64bit integer. > Currently we can do any necessary 64bit maths on the keys in the > database, but for cross database working a consistent solution inside > PHP would help. Well, you also get 64-bit support for free with GMP. Maybe it’s “overkill”, but it does solve your use case. If you really want to go and add 64-bit emulation to 32-bit builds, be my guest. But nobody’s gone and done that. -- Andrea Faulds http://ajf.me/

« previous php.internals (#78056) next »