Re: note 24533 added to function.unset

From: Date: Tue, 20 Aug 2002 22:52:08 +0000
Subject: Re: note 24533 added to function.unset
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-35278@lists.php.net to get a copy of this message
Look again at the logic of your loops and assignments and you'll see the error. Your note will be removed. --- mendes@costapaula.com.br wrote: > Look at this example: > > <? > $test = array('one', 'two', 'three'); > for ($i = 0; $tmp = $test[$i]; $i++) { > echo $test[$i] . " "; > } > echo " - "; > $id = array_search("two", $test); > unset($test[$id]); > for ($i = 0; $tmp = $test[$i]; $i++) { > echo $test[$i] . " "; > } > ?> > > results: > one two three - one > > The function unset() unsets the given element and > all elements after. > -- > http://www.php.net/manual/en/function.unset.php > http://master.php.net/manage/user-notes.php?action=edit+24533 > http://master.php.net/manage/user-notes.php?action=delete+24533 > http://master.php.net/manage/user-notes.php?action=reject+24533 > > > -- > PHP Notes Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== --- Jesus M. Castagnetto <jmcastagnetto@php.net> __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com

« previous php.notes (#35278) next »