Posted by Berislav Lopac on 10/24/26 11:17
Bob Johnson wrote:
> 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.
You can try this:
$keys = array_keys($foo);
$fum = $foo[$keys[0]];
Berislav
Navigation:
[Reply to this message]
|