Re: [DRAFT][RFC] Big Integer Support

From: Date: Thu, 26 Jun 2014 12:12:27 +0000
Subject: Re: [DRAFT][RFC] Big Integer Support
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-75092@lists.php.net to get a copy of this message
Andrea Faulds wrote (on 26/06/2014):
On 26 Jun 2014, at 12:15, Alexey Zakhlestin <indeyets@gmail.com> wrote:
On 26 Jun 2014, at 01:04, Andrea Faulds <ajf@ajf.me> wrote:
I’m less concerned about whether bigints become string keys or preserve their int-ness, as the difference to the end-user is much lesser. If I did add support for bigint keys, I’d probably just do so by storing them as strings and converting to bigint on output.
The difference is quite noticeable actually. for example, http://docs.php.net/array_merge “If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, but will be appended.”
Ooh, good catch. I guess I’ll have to look into whether bigint keys are possible, then. -- Andrea Faulds http://ajf.me/
Another behaviour that would need to be defined one way or the other is the [] array-push operator. Currently the following produces a warning and doesn't add anything to the array: $a = array(PHP_INT_MAX => 'a'); $a[] = 'b'; I'm assuming if bigint keys were available, PHP_INT_MAX would still have the same value, but PHP_INT_MAX + 1 would become a valid key, making this work transparently. -- Rowan Collins [IMSoP]

« previous php.internals (#75092) next »