Re: Any interest in a list type?

From: Date: Tue, 21 Apr 2020 21:52:48 +0000
Subject: Re: Any interest in a list type?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-109765@lists.php.net to get a copy of this message
Hello again, Andrea Faulds wrote:
Hi, Matthew Brown wrote:
I imagine such a "list" type would be a subtype of "array" – everywhere that array was accepted, a list would be also, and it would have the same copy-on-write behaviour.
IIRC with the modern implementation of arrays in the Zend Engine, you can check that an array has no string keys, has keys in the right order, and possibly even that they are all numbered 0 through (count($arr) - 1) without gaps.
Sorry, what I meant to say was “you can check [quickly in O(1) time] that an array has no string keys [etc]”. This is because of the Zend Engine's “packed arrays”. Thanks, Andrea

« previous php.internals (#109765) next »