View Single Post

  #2 (permalink)  
Old 05-30-2005
Chris Hope
 
Posts: n/a
Default Re: Accessing Key=> Value Array by Index

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.


That's because there is no value in your array with index 0.

> HELP!!!


Refer to the array_keys() function to find out how to get all the index
names of an array: http://www.php.net/array_keys

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Reply With Quote