Posted by Kimmo Laine on 11/01/00 11:17
"Bob Johnson" <bob@acme.com> kirjoitti
viestissδ:300520051442288433%bob@acme.com...
>
> I hope this is a silly questions (been programming for 4 days
> straight)...
>
> Given an array:
> $foo = array(one=>11,two=>22,tree=>33);
>
> $fum = $foo[0];
>
> $fum returns null. There are cases where I won't know the name "one"
> and still need to access by Index.
>
I use the foreach control structure:
foreach($foo as $key => $value) {
echo "$key contains $value<br>";
}
read all about it @ http://www.php.net/foreach
--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears
eternal.erectionN0@5P4Mgmail.com
[Back to original message]
|