Re: Question on the list() function

From: Date: Mon, 10 Sep 2001 18:49:21 +0000
Subject: Re: Question on the list() function
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-66800@lists.php.net to get a copy of this message
Hmm.. I dont think I agree with you on that. First the code works perfect, second its just using two list() rather then one, otherwise its exactly the same thing as you say would work, which is what makes me think its a two dimensional array. Ken _lallous wrote in message <20010910091511.71813.qmail@pb1.pair.com>... >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 (#66800) next »