Re: Arrays
| From: | Rasmus Lerdorf | Date: | Mon, 31 Jul 2000 20:12:51 +0000 |
| Subject: | Re: Arrays | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1649@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