Re: Question on the list() function

From: Date: Mon, 10 Sep 2001 10:11:51 +0000
Subject: Re: Question on the list() function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-66706@lists.php.net to get a copy of this message
I don't think this is correct! You can't do this: list($a, $b) = variable! which is the case in: list($key, list($tag, $data)) = each($array) you can use: list($key, $value) = each($array) "D" <d@d.d> wrote in message news:20010910042149.83339.qmail@pb1.pair.com... > I am a newbie and having some problems with a function I found in a script: > > while(list($key,list($tag,$data))=each($array)) > > From what I have read of list(), what I assume is happening here is that its > takeing a 2 dimensional array and assigning the key value pairs accordingly, > so that I can then work with the data using the $key, $tag, and $data > variables while it cycles through each item in the array. Is this correct? > > If this is correct, which order is the dimension of the array? For example > if the values of the variables were: $tag = 2 and $key = 1 would it be: > $array[1][2] or $array[2][1] > > I have tried both, and dont get the $data (outside of the while loop I am > trying to access specific parts of the array). Other thoughts? > > Thanks for the help, > > Ken > > >

« previous php.general (#66706) next »