Re: why doesn't list() handle associative arrays?

From: Date: Wed, 07 Feb 2001 02:22:57 +0000
Subject: Re: why doesn't list() handle associative arrays?
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-45914@lists.php.net to get a copy of this message
yes, that's what I mean. At 03:09 7.2. 2001, Lars Torben Wilson wrote the following: -------------------------------------------------------------- >Cynic writes: >> $a['x'] = 'one' ; >> $a['y'] = 'two' ; >> $a['z'] = 'three' ; >> >> list( $x , $y , $z ) = $a ; >> >> Warning: Undefined offset: 2 in ... >> Warning: Undefined offset: 1 in ... >> Warning: Undefined offset: 0 in ... > >You mean that this: > > $a['x'] = 'one'; > $a['y'] = 'two'; > $a['z'] = 'three'; > list($x, $y, $z) = $a; > >...should work like this? > > $x = current(each($a)); > $y = current(each($a)); > $z = current(each($a)); > >Given that numeric indices doen't necessarily indicate element >positions, I don't see why that your request wouldn't be reasonable. ------end of quote------ ____________________________________________________________ Cynic: A member of a group of ancient Greek philosophers who taught that virtue constitutes happiness and that self control is the essential part of virtue. cynic@mail.cz

« previous php.dev (#45914) next »