Re: 4.0.2 Release

From: Date: Thu, 24 Aug 2000 19:57:48 +0000
Subject: Re: 4.0.2 Release
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-30559@lists.php.net to get a copy of this message
in an enumerative array that i unset the index 1 am i guaranteed that while i do a while( list($key, $val) = each($enumerativeArray) ) { // these $key's will be in ascending order // 0, 2, 3, 4 ...> } Thanks Eric On Thu, 24 Aug 2000 chrisv@b0rked.dhs.org wrote: > Yes -- it does. > > --- > Header("Content-type: text/plain"); > $dope = Array("a", "b", "c", "d", "e"); > var_dump($dope); > print "Unsetting \$dope[1]...\n\n"; > unset($dope[1]); > var_dump($dope); > print "Adjusting keys...\n\n'; > $tmp = Array(); > foreach ($dope as $key => $val) { > $tmp[] = $val; > } > $dope = $tmp; > var_dump($dope); > --- > > produces the following output: > > --- > array(5) { > [0]=> > string(1) "a" > [1]=> > string(1) "b" > [2]=> > string(1) "c" > [3]=> > string(1) "d" > [4]=> > string(1) "e" > } > Unsetting $dope[1].... > > array(4) { > [0]=> > string(1) "a" > [2]=> > string(1) "c" > [3]=> > string(1) "d" > [4]=> > string(1) "e" > } > Adjusting keys... > > array(4) { > [0]=> > string(1) "a" > [1]=> > string(1) "c" > [2]=> > string(1) "d" > [3]=> > string(1) "e" > } > > --- > > > Chris > > > On Thu, 24 Aug 2000, Eric Peters wrote: > > > based upon the previous messages andi posted does your comments still hold > > true? > > > > Eric > > > > On Thu, 24 Aug 2000 chrisv@b0rked.dhs.org wrote: > > > > > > 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 > > > > > > > > > > > > > > > > > -- > > > PHP Development Mailing List <http://www.php.net/Âîø÷r‚ > > > oð0…J‚]Z> > > > 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 > > > > > > > > -- > 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 (#30559) next »