Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109765 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 25755 invoked from network); 21 Apr 2020 23:21:17 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 21 Apr 2020 23:21:17 -0000 To: internals@lists.php.net References: Date: Tue, 21 Apr 2020 23:52:48 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 46.59.72.204 Subject: Re: Any interest in a list type? From: ajf@ajf.me (Andrea Faulds) Message-ID: 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