Re: 4.0.2 Release

From: Date: Thu, 24 Aug 2000 19:18:48 +0000
Subject: Re: 4.0.2 Release
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-30553@lists.php.net to get a copy of this message
> Also, for some stupid, stupid reason, when you use unset() on an array, it > not only removes the item but it reduces the index, and not in a way you'd > expect. > > For example: > > $dope = array("a", "b", "c", "d", "e"); > unset($dope[1]); > > What *should* happen is the second array item (b) should disappear. What > *does* happen is that $dope[1] is unset, AND the index is reduced, but the > item isn't deleted. So your array now goes "a", (blank), "c", > "d". Both > "b" and "e" were lost. PHP always uses associative arrays -- so performing unset() on an array index leaves you with the proper number of elements. Your array just no longer contans the key 1 when you do the above. > > Very annoying. > > > > is that proper behavior? Yes. > > Seems like a bug to me and curious if it ever got fixed - i'm having to > array_splice to delete any values currently If you're expecting the array to magically decrement the remaining indexes after the value you unset .. it appears as though you'll have to use array_splice to do it, unless someone else knows a better way. Or, better yet -- unset($dope[1]); $tmp = Array(); foreach ($dope as $key =>$val) { $tmp[] = $val; } $dope = $tmp; > > it would be helpfull to know if the 4.0.2 release will include that fix > > Thanks > > Eric > > > On Thu, 24 Aug 2000, Andi Gutmans wrote: > > > Well for a change the code freeze really seems to be taking place :) > > I think we're pretty much ready to release. We will post 4.0.2-dev Windows > > binaries soon and I think we should be ready to roll 4.0.2 on Monday when > > everyone's back from the weekend. > > Reminder: Don't commit any big patches unless they are bug fixes and you're > > REALLY sure they are correct. > > > > Andi > > --- > > Andi Gutmans <andi@zend.com> > > http://www.zend.com/ > > > > -- > > PHP Development Mailing List <http://www.php.net/> > > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > > For additional commands, e-mail: php-dev-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.dev (#30553) next »