Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:2719 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5254 invoked from network); 24 Jun 2003 15:35:35 -0000 Received: from unknown (HELO netphobia.fi) (213.243.181.8) by pb1.pair.com with SMTP; 24 Jun 2003 15:35:35 -0000 Received: from localhost (jani@localhost) by netphobia.fi (8.11.6/8.11.6) with ESMTP id h5OFZU028341; Tue, 24 Jun 2003 18:35:31 +0300 X-Authentication-Warning: netphobia.fi: jani owned process doing -bs Date: Tue, 24 Jun 2003 18:35:30 +0300 (EEST) Sender: jani@netphobia.fi Reply-To: Jani Taskinen To: Lars Torben Wilson cc: internals@lists.php.net In-Reply-To: <1056223169.965.68.camel@ali> Message-ID: References: <1056223169.965.68.camel@ali> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] Array behaviour change intentional? From: sniper@iki.fi (Jani Taskinen) On Sat, 21 Jun 2003, Lars Torben Wilson wrote: >Hi there, > >It seems that array appending has changed wrt negative indices. I had >just documented the new behaviour but now I'm not entirely sure whether >I've just documented an unintentional change. Is this new behaviour what >is desired (i.e. skipping straight from some negative key to 0 when >appending with $arr[] = ). > > > >Thanks for any insight, > > >Torben > > >Test script: >$arr[-5] = "minus five"; >$arr[] = "minus four"; >var_dump($arr); >?> > > >Output PHP 4.2.1: >array(2) { > [-5]=> > string(10) "minus five" > [-4]=> > string(10) "minus four" >} Output PHP 4.2.3: array(2) { [-5]=> string(10) "minus five" [-4]=> string(10) "minus four" } Output PHP 4.3.1: array(2) { [-5]=> string(10) "minus five" [0]=> string(10) "minus four" } > >Output PHP 4.3.2: >array(2) { > [-5]=> > string(10) "minus five" > [0]=> > string(10) "minus four" >} Seems to have been changed in between 4.2.3 and 4.3.0. There is/was some bug reports about this too, iirc. Not very critical, I don't think there are that many scripts using this? --Jani