Re: Arrays
| From: | Tim | Date: | Mon, 31 Jul 2000 21:00:43 +0000 |
| Subject: | Re: Arrays | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1650@lists.php.net to get a copy of this message | ||
> > What's the easiest way to loop through an array? I am using PHP3 - I
know
> > that PHP4 has a "foreach" structure, but sadly this is not there in
version
> > 3. I know it's probably something to do with a "while" loop - but how
> > exactly is it done? I have an array of 5 variables, and some of the
> > variables may be empty.
>
> while(list($key,$value)=each($array)) {
> echo "$key: $value<br>\n";
> }
>
> -Rasmus
Thanks... I'm a bit of a newbie, so I'm not sure what the $key variable
does... is it the index for the array?